I’m trying to set up another Xcode project as the one passed on launch for the purposes of testing an Xcode extension:
Rather than hardcoding a path like this, I’d like to make it relative to the current directory.
I created a placeholder build script and output the environment variables. I found out that the current project directory can be accessed via the PROJECT_DIR
environment variable.
How do I reference this environment variable in the Arguments Passed On Launch screen?
For example, instead of /Users/zoesmith/Desktop/Sample/TestableCode.xcodeproj
, I’d like the path to be something like this instead:
PROJECT_DIR/../TestableCode.xcodeproj
2
Answers
Looks like the following works:
I think the quotes are required in case
PROJECT_DIR
has any spaces in it.I'm not sure what the difference is between
$PROJECT_DIR
and$(PROJECT_DIR)
, but both seem to work.One additional hint for anyone having trouble getting this working: Make sure the
Expand Variables Based On
setting is not set toNone
.