When a GNUstep app is used as external editor, NSWorkspace is used to open

the file using the repsective app.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/projectcenter/trunk@12622 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Philippe C.D. Robert 2002-02-21 12:50:31 +00:00
parent 5d42b6bb67
commit 78eaf33537

View file

@ -28,13 +28,31 @@
NSTask *editorTask; NSTask *editorTask;
NSMutableArray *args; NSMutableArray *args;
NSString *editor = [ud objectForKey:Editor]; NSString *editor = [ud objectForKey:Editor];
NSString *app;
NSArray *ea = [editor componentsSeparatedByString: @" "]; NSArray *ea = [editor componentsSeparatedByString: @" "];
args = [NSMutableArray arrayWithArray:ea]; args = [NSMutableArray arrayWithArray:ea];
app = [args objectAtIndex: 0];
if( [[app pathExtension] isEqualToString:@"app"] )
{
BOOL ret = [[NSWorkspace sharedWorkspace] openFile:path
withApplication:app];
if( ret == NO )
{
NSLog(@"Could not open %@ using %@",path,app);
}
return;
}
editorTask = [[NSTask alloc] init]; editorTask = [[NSTask alloc] init];
[editorTask setLaunchPath:[args objectAtIndex: 0]];
[editorTask setLaunchPath:app];
[args removeObjectAtIndex: 0]; [args removeObjectAtIndex: 0];
[args addObject:path]; [args addObject:path];
[editorTask setArguments:args]; [editorTask setArguments:args];
AUTORELEASE( editorTask ); AUTORELEASE( editorTask );