Merge branch 'fix_interspacing'
[GitX.git] / PBCLIProxy.mm
blob12e919b26506ce3095967bed04843d46dfe9bb8b
1 //
2 //  PBCLIProxy.mm
3 //  GitX
4 //
5 //  Created by CiarĂ¡n Walsh on 15/08/2008.
6 //  Copyright 2008 __MyCompanyName__. All rights reserved.
7 //
9 #import "PBCLIProxy.h"
10 #import "PBRepositoryDocumentController.h"
12 @implementation PBCLIProxy
13 @synthesize connection;
15 - (id)init
17         if (self = [super init]) {
18                 self.connection = [NSConnection new];
19                 [self.connection setRootObject:self];
21                 if ([self.connection registerName:ConnectionName] == NO)
22                         NSBeep();
24         }
25         return self;
28 - (BOOL)openRepository:(NSURL*)repositoryPath error:(NSError**)error;
30         // FIXME I found that creating this redundant NSURL reference was necessary to
31         // work around an apparent bug with GC and Distributed Objects
32         // I am not familiar with GC though, so perhaps I was doing something wrong.
33         NSURL* url = [NSURL fileURLWithPath:[repositoryPath path]];
34         if (id document = [[PBRepositoryDocumentController sharedDocumentController] openDocumentWithContentsOfURL:url display:YES error:nil]) {
35                 [NSApp activateIgnoringOtherApps:YES];
36                 return YES;
37         }
38         return NO;
40 @end