• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: More NSFileManager Issues
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: More NSFileManager Issues


  • Subject: Re: More NSFileManager Issues
  • From: Andreas Grosam <email@hidden>
  • Date: Mon, 29 Oct 2012 13:27:02 +0100

On 29.10.2012, at 12:30, Mike Abdullah wrote:

>
> On 29 Oct 2012, at 09:56, Andreas Grosam <email@hidden> 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.

I put those lines in only for the sake of testing. With the correct URL, deleting the file works as expected.

Thank you for the hint, anyway :)

> 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@hidden)

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:

This email sent to email@hidden

References: 
 >More NSFileManager Issues (From: Andreas Grosam <email@hidden>)
 >Re: More NSFileManager Issues (From: Mike Abdullah <email@hidden>)

  • Prev by Date: Re: createDirectoryAtPath:withIntermediateDirectories:attributes:error: Returns NO when it exists
  • Next by Date: Re: Sandbox, security bookmarks and trash
  • Previous by thread: Re: More NSFileManager Issues
  • Next by thread: ARC question
  • Index(es):
    • Date
    • Thread