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] ;


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 !!

Colas
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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 arch...@mail-archive.com

Reply via email to