Problem getting correct file URL in NSTask process
Problem getting correct file URL in NSTask process
- Subject: Problem getting correct file URL in NSTask process
- From: Antonio Nunes <email@hidden>
- Date: Thu, 27 May 2010 10:33:35 +0100
Hi,
I have a daemon that spawns NSTasks on request. A task is passed a number of paths to process. These paths are pased correctly to the task, and in the task I can correctly extract the path string from optarg. When I try to turn the path into a file url however, the resulting URL is not correct.
For instance: I create a string from the argument:
NSString *path = [[[NSString alloc] initWithBytes:(UInt8 *)optarg length:strlen(optarg) encoding:NSMacOSRomanStringEncoding] stringByExpandingTildeInPath];
At this point path is "/Volumes/MyDisk/Users/sonata/Desktop/Stash/BPSystemStartup.pdf"
When I subsequently call [NSURL fileURLWithPath:path] the result is " "/Volumes/MyDisk/Users/sonata/Desktop/Stash/BPSystemStartup.pdf" -- /Volumes/MyDisk/Users/sonata/Documents/Xcode Projects/builds/Debug/"
The task launched by NSTask is a command line app that works just fine when run on its own (e.g. from the terminal). The issue only happens when launching the command line app through NSTask. Any pointers to why this happens?
António
-----------------------------------------------------------
Don't believe everything you think
-----------------------------------------------------------
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden