mirror of
https://github.com/gnustep/apps-projectcenter.git
synced 2025-02-21 19:01:18 +00:00
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:
parent
5d42b6bb67
commit
78eaf33537
1 changed files with 22 additions and 4 deletions
|
@ -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 );
|
||||||
|
|
Loading…
Reference in a new issue