Search code examples
xcodexcode4

Is it possible to acquire the workspace path in Xcode 4 via an environment variable


I can't find anything workspace related in the Xcode Build Setting Reference.

Essentially I need something like $(WORKSPACE_DIR). If Xcode doesn't provide it, is there any way to define a custom user variable that could somehow accurately provide the workspace path in the event that the working workspace were to move (think branches etc)?


Solution

  • Custom variables can be defined under build settings. I think there is a button named Add Build Setting. So, a new variable workspace root can be defined relative to the SRCROOT or use absolute path.

    The new setting is shown under "User Defined" group in build settings. "Add Build Setting" button is near lower right corner.