@@ -116,35 +116,9 @@ void handleDiffWithArguments(NSURL *repositoryURL, NSArray *arguments)
116116
117117void handleOpenRepository (NSURL *repositoryURL, NSMutableArray *arguments)
118118{
119- // if there are command line arguments send them to GitX through an Apple Event
120- // the recordDescriptor will be stored in keyAEPropData inside the openDocument or openApplication event
121- NSAppleEventDescriptor *recordDescriptor = nil ;
122- if ([arguments count ]) {
123- recordDescriptor = [NSAppleEventDescriptor recordDescriptor ];
124-
125- NSAppleEventDescriptor *listDescriptor = [NSAppleEventDescriptor listDescriptor ];
126- uint listIndex = 1 ; // AppleEvent list descriptor's are one based
127- for (NSString *argument in arguments)
128- [listDescriptor insertDescriptor: [NSAppleEventDescriptor descriptorWithString: argument] atIndex: listIndex++];
129-
130- [recordDescriptor setParamDescriptor: listDescriptor forKeyword: kGitXAEKeyArgumentsList ];
131-
132- // this is used as a double check in GitX
133- NSAppleEventDescriptor *url = [NSAppleEventDescriptor descriptorWithString: [repositoryURL absoluteString ]];
134- [recordDescriptor setParamDescriptor: url forKeyword: typeFileURL];
135- }
136-
137- // use NSWorkspace to open GitX and send the arguments
138- // this allows the repository document to modify itself before it shows it's GUI
139- BOOL didOpenURLs = [[NSWorkspace sharedWorkspace ] openURLs: [NSArray arrayWithObject: repositoryURL]
140- withAppBundleIdentifier: kGitXBundleIdentifier
141- options: 0
142- additionalEventParamDescriptor: recordDescriptor
143- launchIdentifiers: NULL ];
144- if (!didOpenURLs) {
145- printf (" Unable to open GitX.app\n " );
146- exit (2 );
147- }
119+ GitXApplication *gitXApp = [SBApplication applicationWithBundleIdentifier: kGitXBundleIdentifier ];
120+ [gitXApp open: repositoryURL];
121+ return ;
148122}
149123
150124void handleInit (NSURL *repositoryURL)
0 commit comments