Last active
December 20, 2015 01:39
-
-
Save billibala/6050984 to your computer and use it in GitHub Desktop.
Mac/iOS - Checks whether a file URL is a document package, regular or a folder.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Assume base path is your Desktop | |
NSURL * baseFileURL = [[[NSFileManager defaultManager] URLsForDirectory:NSDesktopDirectory inDomains:NSUserDomainMask] lastObject]; | |
NSURL * fileURL = [baseFileURL URLByAppendingPathComponent:@"__FILE_NAME__"]; | |
// the keys we are interested in | |
NSArray * attrArray = @[NSURLIsPackageKey, NSURLIsRegularFileKey, NSURLIsWritableKey, NSURLIsDirectoryKey]; | |
NSDictionary * theDict = [fileURL resourceValuesForKeys:attrArray error:nil]; | |
NSLog(@"the dict: %@", theDict); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment