Revision: 15223
http://bibdesk.svn.sourceforge.net/bibdesk/?rev=15223&view=rev
Author: hofman
Date: 2009-04-28 16:42:26 +0000 (Tue, 28 Apr 2009)
Log Message:
-----------
Inherit working directory from parent if not set explicitly.
Modified Paths:
--------------
trunk/bibdesk/BDSKTask.m
Modified: trunk/bibdesk/BDSKTask.m
===================================================================
--- trunk/bibdesk/BDSKTask.m 2009-04-28 15:19:38 UTC (rev 15222)
+++ trunk/bibdesk/BDSKTask.m 2009-04-28 16:42:26 UTC (rev 15223)
@@ -165,31 +165,6 @@
- (id)standardOutput; { return _standardOutput; }
- (id)standardError; { return _standardError; }
-// workaround for NSFileManager's asinine main thread requirement; unclear if
using getcwd(3) would be equivalent
-+ (NSString *)newCurrentDirectoryPath
-{
- NSString *path = nil;
- if (pthread_main_np()) {
- path = [[[NSFileManager defaultManager] currentDirectoryPath] copy];
- }
- else if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_4) {
- NSFileManager *fm = [NSFileManager new];
- path = [[fm currentDirectoryPath] copy];
- [fm release];
- }
- else {
- NSFileManager *fm = [NSFileManager defaultManager];
- NSInvocation *inv = [NSInvocation invocationWithMethodSignature:[fm
methodSignatureForSelector:@selector(currentDirectoryPath)]];
- [inv setTarget:fm];
- [inv setSelector:@selector(currentDirectoryPath)];
- NSArray *rlmodes = [NSArray arrayWithObject:(id)kCFRunLoopDefaultMode];
- [inv performSelectorOnMainThread:@selector(invoke) withObject:nil
waitUntilDone:YES modes:rlmodes];
- [inv getReturnValue:&path];
- path = [path copy];
- }
- return path;
-}
-
static void __BDSKTaskNotify(void *info)
{
BDSKTask *task = info;
@@ -213,12 +188,6 @@
{
ASSERT_NOTLAUNCHED;
- if (nil == [self currentDirectoryPath]) {
- NSString *path = [BDSKTask newCurrentDirectoryPath];
- [self setCurrentDirectoryPath:path];
- [path release];
- }
-
NSInteger argCount = [_arguments count];
const char *workingDir = [_currentDirectoryPath fileSystemRepresentation];
char **args = NSZoneCalloc([self zone], (argCount + 2), sizeof(char *));
@@ -293,7 +262,7 @@
if (-1 != fd_out) dup2(fd_out, STDOUT_FILENO);
if (-1 != fd_err) dup2(fd_err, STDERR_FILENO);
- chdir(workingDir);
+ if (workingDir) chdir(workingDir);
int ret = execve(args[0], args, env);
_exit(ret);
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Register Now & Save for Velocity, the Web Performance & Operations
Conference from O'Reilly Media. Velocity features a full day of
expert-led, hands-on workshops and two days of sessions from industry
leaders in dedicated Performance & Operations tracks. Use code vel09scf
and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf
_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit