Re: command line tool paths
Re: command line tool paths
- Subject: Re: command line tool paths
- From: Chris Espinosa <email@hidden>
- Date: Wed, 7 Nov 2007 12:53:09 -0800
On Nov 7, 2007, at 12:20 PM, John Goodman wrote: I'm using Xcode (2.4.1) to compile a command line tool, using some existing Linux code.
The code references a configuration file containing file paths to additional configuration data. The paths in the configuration file are all specified relative to the executable.
When I run the code from Xcode, all these relative paths work to find the appropriate files. When I run the code from the Terminal, the files are not found unless I use absolute paths.
What is Xcode doing to enable the use of relative paths? Can I do something similar to make the relative paths effective running outside of Xcode?
I should add (if it isn't already obvious) that my experience with the Terminal and command line tools approaches zero.
Thanks for your suggestions.
Xcode gives you the choice, when launching an executable, of setting the working directory to:
- the project directory - the build product directory - an arbitrary directory of your choice
The Shell sets the working directory to the current directory when the command is executed, and the initial working directory is your home directory.
The solution is in Terminal to cd (change directory) to the directory containing your executable, then execute it with ./<executablename> . (The ./ is required to prevent people from spoofing command-line builtins with malware executables in user's home directories)
Chris |
_______________________________________________
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