Files
gitx/PBCLIProxy.mm
T
Ciarán Walsh 4547d513d1 Amend the CLI tool to use the distributed objects system to try opening the current path when invoked.
When using the CLI tool (rather than a command using open(1)) it is now possible to open multiple repositores via the command-line.
2008-08-18 18:27:57 +01:00

41 lines
1.0 KiB
Plaintext

//
// PBCLIProxy.mm
// GitX
//
// Created by Ciarán Walsh on 15/08/2008.
// Copyright 2008 __MyCompanyName__. All rights reserved.
//
#import "PBCLIProxy.h"
#import "PBRepositoryDocumentController.h"
@implementation PBCLIProxy
@synthesize connection;
- (id)init
{
if (self = [super init]) {
self.connection = [NSConnection new];
[self.connection setRootObject:self];
if ([self.connection registerName:ConnectionName] == NO)
NSBeep();
}
return self;
}
- (BOOL)openRepository:(NSURL*)repositoryPath error:(NSError**)error;
{
// FIXME I found that creating this redundant NSURL reference was necessary to
// work around an apparent bug with GC and Distributed Objects
// I am not familiar with GC though, so perhaps I was doing something wrong.
NSURL* url = [NSURL fileURLWithPath:[repositoryPath path]];
if (id document = [[PBRepositoryDocumentController sharedDocumentController] openDocumentWithContentsOfURL:url display:YES error:nil]) {
[NSApp activateIgnoringOtherApps:YES];
return YES;
}
return NO;
}
@end