Xcode 4: Perform Action Profile Current Working Directory
Xcode 4: Perform Action Profile Current Working Directory
- Subject: Xcode 4: Perform Action Profile Current Working Directory
- From: Andreas Grosam <email@hidden>
- Date: Sat, 26 Mar 2011 07:14:45 +0100
Starting a console application for Mac with "Product -> Perform Action -> Profile Without Building" does not set the current directory to the directory where the application is located. The option "Working Directory: use custom working directory" in the scheme for the profiler is not checked.
For instance, "Build for Profiling" compiles the Release configuration. The app's location is then
/Users/ME/Library/Developer/Xcode/DerivedData/TestApp-dobnuzuhkitwqtcbuvtnoikrlwam/Build/Products/Release
When running the application from within Xcode with Product -> Run, the current working directory is set to the path where the application is located, as shown above. However, when starting the application for profiling which opens Instruments, the current working directory is set to:
/Users/ME/Library/Developer/Xcode/DerivedData/TestApp-dobnuzuhkitwqtcbuvtnoikrlwam/Build
The application is a simple test application, a console app. For simple test applications I don't want to setup bundles and rely on their hierarchical structure and predefined paths in order to access related accompanying files. In this test app I simply want to open a file which is located in the same directory as the application itself, that is using a relative path, e.g:
NSString* string = [NSString stringWithContentsOfFile:@"TestString.txt"
encoding:NSUTF8StringEncoding
error:&error];
I would have expected that for this project setup (console app) and when running Instruments, the working directory defaults to the location of the executable - like it is when running the application with "Product -> Run". But it is not. Neither unchecking the option "Working Directory: use custom working directory" nor checking it and leaving the path blank would set it to the location of the executable.
How can I achieve this in a more generic way (that is other than setting the absolute path directly) in the Profiler settings?
Thanks for tips ;)
Regards
Andreas _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden