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

@ -25,16 +25,34 @@
if([[ud objectForKey:ExternalEditor] isEqualToString:@"YES"])
{
NSTask *editorTask;
NSTask *editorTask;
NSMutableArray *args;
NSString *editor = [ud objectForKey:Editor];
NSArray *ea = [editor componentsSeparatedByString: @" "];
NSString *editor = [ud objectForKey:Editor];
NSString *app;
NSArray *ea = [editor componentsSeparatedByString: @" "];
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 setLaunchPath:[args objectAtIndex: 0]];
[editorTask setLaunchPath:app];
[args removeObjectAtIndex: 0];
[args addObject:path];
[editorTask setArguments:args];
AUTORELEASE( editorTask );