Re: Removing a file via NSFileWrapper
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