mirror of
https://github.com/gnustep/apps-projectcenter.git
synced 2025-02-19 01:51:09 +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
|
@ -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 );
|
||||
|
|
Loading…
Reference in a new issue