skip to Main Content

I’m trying to set up another Xcode project as the one passed on launch for the purposes of testing an Xcode extension:

enter image description here

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


  1. Chosen as BEST ANSWER

    Looks like the following works:

    "$(PROJECT_DIR)/../TestableCode.xcodeproj"
    

    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.


  2. One additional hint for anyone having trouble getting this working: Make sure the Expand Variables Based On setting is not set to None.

    enter image description here

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search