NSFileWrapper (directory) and internal folders

  • Hello everyone,

    I have a NSFileWrapper which needs to look for a contents folder
    inside an NSFileWrapper. The wrapper is a directory wrapper and
    contains a properties.xml file, and a Contents file with many internal
    files. The problem is I can't use NSDirectoryEnumerator to open the
    Contents folder and load the files into an NSMutableArray.

    Am I approaching this the correct way? I tried looking in google.com/
    codesearch for an example of this. I have even tried using the BigShow
    sample project from bignerdranch.com to guide me along.

    Can someone maybe point to a good sample of how I can accomplish this.
    Posted is my code to open the NSFileWrapper. Feel free to use it if
    your project needs something like this.

    - (BOOL)loadFileWrapperRepresentation:(NSFileWrapper *)wrapper ofType:
    (NSString *)aType {
    NSDictionary *wrappers = [wrapper fileWrappers];
    NSArray *files = [wrappers allKeys];
    NSXMLDocument *propertiesDocument;

    files = [files
    sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)];
    int countOfFiles;

    for (countOfFiles = 0; countOfFiles < [files count]; countOfFiles++) {
      NSString *fileName = [files objectAtIndex:countOfFiles];
      if ([fileName isEqualToString:@"properties.xml"]) {
      NSLog(@"Loaded properties.xml file");
      NSURL *propertiesDocumentURL = [NSURL fileURLWithPath:fileName];
      propertiesDocument = [[NSXMLDocument alloc]
    initWithContentsOfURL:propertiesDocumentURL
    options:NSXMLNodePreserveAll error:nil];
      } else if ([fileName isEqualToString:@"Contents"]) {
      NSLog(@"Found Contents folder");
      // NSDirectoryEnumerator *directoryEnum = [[NSFileManager
    defaultManager] enumeratorAtPath:fileName];
      // This doesn't return any internal results. Added to TDManager.
      } else {
      return NO;
      }
    }
    return YES;
    }

    Any help would be appreciated.

    Thanks,
    Rick L.
previous month december 2007 next month
MTWTFSS
          1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31            
Go to today