Problem with NSFileManager
Problem with NSFileManager
- Subject: Problem with NSFileManager
- From: "K. Chen" <email@hidden>
- Date: Wed, 2 Sep 2009 11:50:40 -0700
I ran into a weird situation with NSFileMnager.
First my code want to see if a file already exists
if (![fileManager fileExistsAtPath:myConfigFile])
the result is NO, so my code goes into the if block
Then my code tries to copy the file over from the bundle; note the the destination is under <app_home>/Documents.
if (![fileManager copyItemAtPath:configFilePath toPath:myConfigDir error:&err])
Here I got the error message from [NSError localizedDescription] saying: Operation could not be completed. File exists.
Well first FM told me the file doesn't exist and then when I tried to copy, it said it already exists???
I suspect the file was in a weird state so I tested with another function and got some extra info.
if (![fileManager removeItemAtPath: myConfigFile error:&err])
Here it got another error: Operation could not be completed. (Cocoa error 4)
Any help will be appreciated.
-KC
_______________________________________________
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