xcodexcode5

Xcode: How to set current working directory to a relative path for an executable?


I have a command-line executable in Xcode.

I am using Xcode 5.1. In the "Scheme Editor" for the project under "Options" there is an option for "Working Directory". How can I specify a path relative to the .xcodeproj file? I have tried a single period.

I need this because the code needs to assume the existence of files relative to the project directory.


Solution

  • You can use Xcode build setting variables such as PROJECT_DIR, e.g. setting your working directory to $PROJECT_DIR/.. will make it equal to the parent directory of your project directory.