Re: FW: NSFileManager
Re: FW: NSFileManager
- Subject: Re: FW: NSFileManager
- From: Jonathan Stimmel <email@hidden>
- Date: Sun, 24 Jun 2001 13:47:50 -0700
- Mail-followup-to: Jonathan Stimmel <email@hidden>, Cocoa-Dev <email@hidden>
On Sun, Jun 24, 2001 at 01:10:36PM -0700, Tommy Braas wrote:
>
Although it might not be a programmatic but it is definitely a documentation bug. I think it should clearly state under which circumstances [ NSFileManager currentDirectoryPath ] returns what.
>
>
Am I the only one that thinks that?
How would you clarify this method? The method itself doesn't set the
current working directory, it's inherited from the process/application
that launched your application. You could document the finder's behavior,
but what if your program is launched from another location? What if the
finder's behavior changes in a future release (not likely, admittedly)?
What if (as already pointed out) someone starts your app from the command
line, where the cwd could be anywhere on the filesystem? Yes, I have
done the last one, though I don't make a habit of it...
The basic rules I follow when writing shell scripts (same applies to apps):
- don't make any assumptions about what it will be at startup (unless
you've clearly documented your program's requirements to the user)
- if you care about the cwd, check and/or set it yourself