• 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
Re: NSTask: auxiliary executable does not see its data file
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTask: auxiliary executable does not see its data file


  • Subject: Re: NSTask: auxiliary executable does not see its data file
  • From: Jens Alfke <email@hidden>
  • Date: Wed, 01 Aug 2012 22:41:47 -0700

On Jul 30, 2012, at 8:08 AM, Daniel Stein <email@hidden> wrote:

> The tool tries to open the file with an ordinary call to fopen():
> f = fopen("my.data",READ_MODE);

Of course this assumes the current directory is the one containing the my.data file. By default it won't be, because the tool inherits the current directory from the app, and IIRC when an app is launched the CWD is set to the root directory of its bundle.

In general it's not a good idea to depend on the CWD in an app anyway. Why not pass the absolute path of the data file as a command-line argument to the tool from NSTask?

> //[ backEnd setCurrentDirectoryPath: [ path stringByDeletingLastPathComponent ] ];
>
> Of course, I'm concerned about having had to comment out the setCurrentDirectoryPath operation

Um, yeah. But you haven't said why you commented it out. From what I remember about NSTask, that line would have set things up so your existing tool would work.

—Jens
_______________________________________________

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


References: 
 >NSTask: auxiliary executable does not see its data file (From: Daniel Stein <email@hidden>)

  • Prev by Date: Re: Threading issue
  • Next by Date: Re: reading preferences from com.apple.mail under 10.8
  • Previous by thread: NSTask: auxiliary executable does not see its data file
  • Next by thread: Re: Trying to capture raw touch events on the trackpad
  • Index(es):
    • Date
    • Thread