• 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: Removing a file via NSFileWrapper
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Removing a file via NSFileWrapper


  • Subject: Re: Removing a file via NSFileWrapper
  • From: Mike Abdullah <email@hidden>
  • Date: Sat, 29 Mar 2014 16:51:24 +0000

On 29 Mar 2014, at 16:43, Colas B <email@hidden> wrote:

> Dear cocoa-dev,
>
> There is a problem when I try to remove a file from a folder via NSFileWrapper. I don't know if this is an important info, but the folder is inside a "package" (a folder with an extension).
>
> I have a folder "(...)/attached_files" on my disk.
> I create a NSFileWrapper with
> self.fileWrapper= [[NSFileWrapperalloc] initWithURL:myURL
>                                               options:0
>                                                 error:error] ;
>
>
> Then, I remove one of the sub-subwrappers with the command
> NSFileWrapper * theSubWrapper = [[self.fileWrapper fileWrappers] valueForKey:@"subFolder_1"] ;
> NSFileWrapper * theSubSubWrapper = [[theSubWrapper fileWrappers] valueForKey:@"subSubFolder_1"] ;
> [theSubWrapper removeFileWrapper:theSubSubWrapper] ;

Are you sure both theSubWrapper and theSubSubWrapper aren't nil?
>
>
> Then, I save with
> [self.fileWrapper writeToURL:myURL
>                      options:NSFileWrapperWritingAtomic| NSFileWrapperWritingWithNameUpdating
>          originalContentsURL:myURL
>                        error:error] ;
>
> If I open the folder and check if the file has been removed, the file is still there.
> But, if I try to open it, the Finder throws an error "The Application does not exist".
>
> If anyone has a good experience with NSFileWrapper, more information about the options of the writeToUrl:... command would be appreciated. Indeed, if I don't use the "NSFileWrapperWritingAtomic", I have an error : "can't write because the file already exists".
>
> Thanks to all !!

_______________________________________________

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


  • Follow-Ups:
    • Re: Removing a file via NSFileWrapper
      • From: Colas B <email@hidden>
References: 
 >Removing a file via NSFileWrapper (From: Colas B <email@hidden>)

  • Prev by Date: Removing a file via NSFileWrapper
  • Next by Date: Removing object as observer in -willTurnIntoFault
  • Previous by thread: Removing a file via NSFileWrapper
  • Next by thread: Re: Removing a file via NSFileWrapper
  • Index(es):
    • Date
    • Thread