Skip navigation.
 
mlNSFileWrapper Directories
FROM : Todd Yandell
DATE : Sat Dec 11 05:27:01 2004

Hi,

I'm using the fileWrapperRepresentationOfType message from NSDocument
to save an NSFileWrapper as a directory that contains several files. In
the same way the Finder treats an App file, I'd like my file to be
treated as a single file, rather than a folder. However, everything
I've tried has resulted in just creating a folder, and not a "package".
I don't see anything suspicious in my code, but I've pasted it below if
anyone wants to take a look.

- (NSFileWrapper *)fileWrapperRepresentationOfType:(NSString *)type
{
   NSMutableDictionary *fileWrappers;
   fileWrappers = [NSMutableDictionary dictionaryWithCapacity:1];

   [fileWrappers setObject:[[[NSFileWrapper alloc]
initRegularFileWithContents:
       [NSKeyedArchiver archivedDataWithRootObject:[self documentProject]]]
       autorelease] forKey:@"Project.plist"];
   
   /* ...
   The rest of the files are created like so:
   [fileWrappers setObject:[NSFileWrapper ...] forKey:(...)];
   ... */

   return [[[NSFileWrapper alloc]
       initDirectoryWithFileWrappers:fileWrappers] autorelease];
}

Thanks in advance!

— Todd

Related mailsAuthorDate
mlNSFileWrapper Directories Todd Yandell Dec 11, 05:27
mlRe: NSFileWrapper Directories Louis C. Sacha Dec 12, 11:04