On 29 Oct 2012, at 09:56, Andreas Grosam <[email protected]> wrote:
> I do have even more weird issues with NSFileManager:
>
>
> With NSFileManager I've created a file in the temporary directory. Attempting
> to delete it, fails:
>
> NSFileManager* fm = [[NSFileManager alloc] init];
> NSLog(@"tmp file: %@", [_input1000 path]);
> BOOL isDirectory;
> if ([fm fileExistsAtPath:[_input1000 path]
> isDirectory:&isDirectory] || isDirectory) {
> NSError* error;
> if ([fm removeItemAtURL:_input1000 error:&error] == NO) {
> NSLog(@"ERROR: tear down testing environment with error:
> %@", error);
> }
> }
Further to earlier answers, you're wasting your time checking if the directory
exists. Just go ahead and delete it. If the deletion fails, check the error
code & domain to see if it's because the directory doesn't exist, and ignore
that specific case.
_______________________________________________
Cocoa-dev mailing list ([email protected])
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [email protected]