RE:currentDirectoryPath returns different paths
RE:currentDirectoryPath returns different paths
- Subject: RE:currentDirectoryPath returns different paths
- From: "Jordan Evans" <email@hidden>
- Date: Thu, 27 Jul 2006 09:21:57 -0700
Why is it so?
How do I get the actual current working directory?
First, take control of the current directory with this method:
- (BOOL)changeCurrentDirectoryPath:(NSString *)path
Your app will stay in that directory, until your app changes the
directory. -currentDirectory will return that path until you change
the path with -changeCurrentDirectoryPath:.
I remember some confusion with NSFileHandle and directories at first
and tried the following method, just to prove the current directory.
To get myself oriented at any line of code in the program I might be
confused with, I simply created an empty file in the relative sense
(just a name, no directory designation).
[aFileHandle createFileAtPath:@"testFile" contents:nil attributes:nil];
I stopped the app and searched for that file. A file created in this
way will always be created in the current directory. Although this
proves it, it's tedious. I would control your directory by always
using the -changeCurrentDirectoryPath: before any writing or reading.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden