• 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
runtime execution path for NSTask
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

runtime execution path for NSTask


  • Subject: runtime execution path for NSTask
  • From: Chris Heimark <email@hidden>
  • Date: Fri, 13 Jul 2007 15:04:20 -0400

Hi:

I'm using an NSTask object to run a command line program. Everything works as expected and I am just buttoning things up ... one of which is a hard coding of a path to my executable for NSTask. If I let Xcode execute either debug or release versions of Cocoa app, it finds my executable in same directory no problem. When I double-click Cocoa app out of finder, execution path is marked as '/' which I have discovered has the meaning of 'relative path' in this context. If a command line program and Cocoa app are in same directory, how do I tell NSTask that executable is in same path (not relative) as the launching Cocoa app?

I have searched docs high and low and find only vague reference to relative path using NSFileManager methods.

"Puzzled in Malvern, PA, USA"

Chris


if ([[[NSFileManager defaultManager] currentDirectoryPath] isEqualToString:@"/"])
// this does not work when executing release or debug code from finder
xpath = @"read-data-usb";
else
// this works no problem when Xcode runs either release or debug code
xpath = [[[NSFileManager defaultManager] currentDirectoryPath]
stringByAppendingString:@"/read-data-usb"];



_______________________________________________

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: runtime execution path for NSTask
      • From: Nick Zitzmann <email@hidden>
    • Re: runtime execution path for NSTask
      • From: "Tom Harrington" <email@hidden>
References: 
 >Re: reason for getting NSFileHandle:writeData exception (From: Kevin Kuehl <email@hidden>)

  • Prev by Date: Re: NSOutlineView with an image and text
  • Next by Date: Re: runtime execution path for NSTask
  • Previous by thread: Re: reason for getting NSFileHandle:writeData exception
  • Next by thread: Re: runtime execution path for NSTask
  • Index(es):
    • Date
    • Thread