Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I use an environment variable in the Xcode Scheme Arguments Passed On Launch window?

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
like image 495
Senseful Avatar asked Oct 23 '25 14:10

Senseful


1 Answers

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.

like image 134
Senseful Avatar answered Oct 26 '25 06:10

Senseful



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!