I have some code that perfoms a deep enumeration of system frameworks (it collects .bridgesupport files). It seems that `enumeratorAtURL:includingPropertiesForKeys:options:errorHandler:` behaves differently in such a case under 19A512f, skipping directory contents. I have to use `subpathsAtPath:` instead.
Here's some code that demonstrates the problem:
NSFileManager *fileManager = [NSFileManager defaultManager];
NSURL *fwURL = [NSURL fileURLWithPath:@"/System/Library/Frameworks/Foundation.framework"];
// fwURL = [[fileManager URLsForDirectory:NSDesktopDirectory inDomains:NSUserDomainMask] firstObject];
//This returns all subpaths OK:
NSArray *temp = [fileManager subpathsAtPath:fwURL.path];
NSLog(@"There are %lu subpaths at %@\n", (unsigned long)temp.count, fwURL.path);
NSDirectoryEnumerator *enumerator = [fileManager enumeratorAtURL:fwURL includingPropertiesForKeys:@[NSURLIsDirectoryKey] options:0 errorHandler:NULL];
NSArray *urls = [enumerator allObjects];
NSLog(@"There are %lu urls at %@", (unsigned long)urls.count, fwURL.path);
if (urls.count < temp.count) {
NSLog(@"URLs found: %@\n", [[urls valueForKey:@"path"] componentsJoinedByString:@"\n"]);
}
If you uncomment the line that modifies `fwURL`, you will see the code works fine for the Desktop directory. This suggests it might be somehow either security related (and undocumented as far as I can see), or a problem with URLs linking to the system drive. Either way, it seems like a serious bug/change in behavior.
I logged a bug (FB 6800366). The response I've received is:
This is clearly not the case: NSDirectoryEnumerationSkipsSubdirectoryDescendants is defined as 1UL << 0.
Anyone care to give me a sanity check on this?