Reputation: 832
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.
Upvotes: 11
Views: 22573
Reputation: 14328
For new version Xcode (here 14.3.1
):
Xcode
->Product
->Scheme
->Edit Scheme...
->Run->Run
->Options
tab ->Working Directory
-> choose/select: Use custom working directory
, set to value: $(SOURCE_ROOT)
Upvotes: 1
Reputation: 12247
In Xcode preferences you can change the location of the compiled binaries to be relative to your project, or at any absolute path you like. Go to Preferences
->Locations
and then click on the Advanced...
button below the Derived Data
text field.
In the sheet that pops up set the Build Location
to Custom
, and then select the desired option in the nearby dropdown, and enter whatever paths you like in the Products
field.
Upvotes: 5
Reputation: 212949
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.
Upvotes: 19