• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Problem getting correct file URL in NSTask process
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: Problem getting correct file URL in NSTask process
      • From: Ken Thomases <email@hidden>
  • Prev by Date: Re: isKindofClass with NSData and NSKeyUnarchiver
  • Next by Date: Re: Get controller from nib
  • Previous by thread: Re: isKindofClass with NSData and NSKeyUnarchiver
  • Next by thread: Re: Problem getting correct file URL in NSTask process
  • Index(es):
    • Date
    • Thread