I am trying to enumerate the contents of a directory (aka folder) using NSDirectoryEnumerator. My problem is that the file attributes always returns NSFileTypeRegular, no matter whether it is an alias/symlink or a regular file.
You can see my code below. I have tried to retrieve the file attributes with attributesOfItemAtPath:error: , and with fileAttributes, both dictionaries returned by those methods are exactly the same, AFAICS. According to the documentation https://developer.apple.com/reference/foundation/nsfilemanager/1410452-attributesofitematpath?language=objc I would at least attributesOfItemAtPath:error expect to show NSFileTypeSymbolicLink for the aliases and symlinks. Could some kind soul please shed some light on this? or give me a hint? Thanks a lot in advance. Best regards, Gabriel. My code: - (void) scanDirectoryByHand: (NSString*) dir { NSDirectoryEnumerator * enumerator = [fmanager_ enumeratorAtPath: dir]; for ( NSString * file in enumerator ) { fattrs = [fmanager_ attributesOfItemAtPath: [dir stringByAppendingPathComponent: file] error: NULL]; fattrs = [enumerator fileAttributes]; NSString * filetype = [fattrs objectForKey: NSFileType]; if ( ! [filetype isEqualToString: NSFileTypeRegular] || [NSNumber numberWithBool: YES] == [fattrs objectForKey: NSFileExtensionHidden] ) _______________________________________________ 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