• 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: How to control relative paths in Unix task?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to control relative paths in Unix task?


  • Subject: Re: How to control relative paths in Unix task?
  • From: Ondra Cada <email@hidden>
  • Date: Tue, 23 Jul 2002 01:37:56 +0200

On Monday, July 22, 2002, at 11:20 , John Nairn wrote:

My question: I expect the relative path used in the unix process is building off the unix working directory

Right.

and that directory is set to the application's directory by default.

Wrong. It is set to the parent task's (your application's) cwd. Which is effectively undefined (actually, PB sets it to the app's bundle path, and Finder to root; other launchers can do just anything, and if you run an app from Terminal, it would be the cwd of the parent shell).

How can I control that location and thereby control how the unix process resolves relative paths when it creates file?

Probably the best way is to set the path explicitly when you are launching the unix command -- see -[NSTask setDirectoryPath].

Another possibility is to change the app's cwd -- see setCurrentDirectoryPath (or so) in NSFileManager.
---
Ondra Cada
OCSoftware: email@hidden http://www.ocs.cz
private email@hidden http://www.ocs.cz/oc
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
  • Follow-Ups:
    • Re: How to control relative paths in Unix task?
      • From: Ondra Cada <email@hidden>
References: 
 >How to control relative paths in Unix task? (From: John Nairn <email@hidden>)

  • Prev by Date: Re: Manual layout of controls?
  • Next by Date: Re: How to control relative paths in Unix task?
  • Previous by thread: Re: How to control relative paths in Unix task?
  • Next by thread: Re: How to control relative paths in Unix task?
  • Index(es):
    • Date
    • Thread