Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE:currentDirectoryPath returns different paths



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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.