Re: Textfiles and xCode
Re: Textfiles and xCode
- Subject: Re: Textfiles and xCode
- From: Chris Espinosa <email@hidden>
- Date: Sun, 13 Mar 2005 20:00:11 -0800
On Mar 13, 2005, at 2:02 PM, Bob Austin wrote:
Hi all,
I'm trying to use bbedit to create the text files and have them
accessed by xCode in the Run log or via Terminal with the project's
executable file.
does anyone know where the text files should be located in order
for the code below to run?
I have many more similar sample projects. All of my projects are
based on the Standard Tool template.
I would be happy to know if there is a way to create text files
within xCode so that the project knows where it is and can use it?
I sure appreciate any help and or tips,
ABob
New bee
There's one basic fact and one Xcode trick you need to know.
The Basic Fact: executables should never rely on the current working
directory.
You never know where the user's CWD will be when your executable is
run. Relying on finding anything relative to the CWD (or even
relative to your executable, unless your executable is part of a
bundle) is extremely fragile.
The Unix Way is to either:
a) place required data files in known locations (like /usr/local/
myfolder) on installation and find them there, or
b) pass the location of the data file in a command line argument
(The Macintosh Way is to do a) but get the location from either the
Folder Manager or CFBundle)
But since you're simply trying to get your C algorithm to work and
could care less about platform idioms, here's the Xcode trick:
- select the executable under the "Executables" group in the Groups
and Files tree
- choose Get Info
- observe the "Set the working directory to" section, with three
choices: Build Directory, Project Directory, or Custom Directory. I
think you want Project Directory. (The Build Directory is set either
by your Xcode preferences or overridden by your project settings;
regardless, your data file probably isn't there.)
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