Revision: 2526
http://skim-app.svn.sourceforge.net/skim-app/?rev=2526&view=rev
Author: hofman
Date: 2007-07-18 11:19:48 -0700 (Wed, 18 Jul 2007)
Log Message:
-----------
Add appsupport path to PATH environment variable for pdfsync support.
Modified Paths:
--------------
trunk/SKDocument.m
Modified: trunk/SKDocument.m
===================================================================
--- trunk/SKDocument.m 2007-07-18 11:43:08 UTC (rev 2525)
+++ trunk/SKDocument.m 2007-07-18 18:19:48 UTC (rev 2526)
@@ -57,6 +57,7 @@
#import "PDFSelection_SKExtensions.h"
#import "SKInfoWindowController.h"
#import "SKLine.h"
+#import "SKApplicationController.h"
// maximum length of xattr value recommended by Apple
#define MAX_XATTR_LENGTH 2048
@@ -854,6 +855,7 @@
NSString *editorPreset = [[NSUserDefaults standardUserDefaults]
objectForKey:SKTeXEditorPresetKey];
NSString *editorCmd = [[NSUserDefaults standardUserDefaults]
objectForKey:SKTeXEditorCommandKey];
NSMutableString *cmdString = [[[[NSUserDefaults standardUserDefaults]
objectForKey:SKTeXEditorArgumentsKey] mutableCopy] autorelease];
+ NSMutableDictionary *environment = [[[[NSProcessInfo processInfo]
environment] mutableCopy] autorelease];
if ([editorPreset isEqualToString:@""] == NO) {
NSString *appPath = [[NSWorkspace sharedWorkspace]
fullPathForApplication:editorPreset];
@@ -875,6 +877,25 @@
editorCmd = toolPath;
}
}
+ } else {
+ NSString *path = [environment objectForKey:@"PATH"];
+ NSMutableArray *paths = [NSMutableArray
arrayWithObjects:@"/usr/local/bin", nil];
+ NSString *appSupportPath;
+ if ([path length])
+ [paths insertObject:path atIndex:0];
+ if (appSupportPath = [[NSApp delegate]
applicationSupportPathForDomain:kUserDomain create:NO]) {
+ [paths addObject:appSupportPath];
+ [paths addObject:[appSupportPath
stringByAppendingPathComponent:@"Scripts"]];
+ }
+ if (appSupportPath = [[NSApp delegate]
applicationSupportPathForDomain:kLocalDomain create:NO]) {
+ [paths addObject:appSupportPath];
+ [paths addObject:[appSupportPath
stringByAppendingPathComponent:@"Scripts"]];
+ }
+ if (appSupportPath = [[NSApp delegate]
applicationSupportPathForDomain:kNetworkDomain create:NO]) {
+ [paths addObject:appSupportPath];
+ [paths addObject:[appSupportPath
stringByAppendingPathComponent:@"Scripts"]];
+ }
+ [environment setObject:[paths componentsJoinedByString:@":"]
forKey:@"PATH"];
}
NSRange range = NSMakeRange(0, 0);
@@ -901,6 +922,7 @@
[cmdString replaceCharactersInRange:range withString:[file
stringByEscapingShellChars]];
}
+
[cmdString insertString:@"\" " atIndex:0];
[cmdString insertString:editorCmd atIndex:0];
[cmdString insertString:@"\"" atIndex:0];
@@ -908,6 +930,7 @@
[task setLaunchPath:@"/bin/sh"];
[task setArguments:[NSArray arrayWithObjects:@"-c", cmdString, nil]];
[task setCurrentDirectoryPath:[file
stringByDeletingLastPathComponent]];
+ [task setEnvironment:environment];
[task launch];
}
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit