I have code which generates resources which I want to save in a subdirectory of my $(PROJECT_DIR). How do I get the real path from this environment variable in code?
Asked
Active
Viewed 2,305 times
2 Answers
8
open the projects build settings and add SAVEPATH=@\"$(PROJECT_DIR)\"
to the preprocessor macros.
Then you can get the project directory like this:
NSString *projectDir = SAVEPATH;

Matthias Bauch
- 89,811
- 20
- 225
- 247
0
I'm not sure if Xcode 3.2.6 has changed the way that ()
are used with environment variables, but I've found that using the following pre-processor macro works for me (@fluchtpunkt's answer gives me a compiler error):
PROJECT_DIR=@\""$PROJECT_DIR"\"
Then I can do:
NSString *savePath = [PROJECT_DIR stringByAppendingPathComponent:@"Save Folder"];

Nick Forge
- 21,344
- 7
- 55
- 78