Created
April 15, 2012 23:25
-
-
Save brennon/2395305 to your computer and use it in GitHub Desktop.
Problem examples
This file contains hidden or 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
- (BOOL)directoryIsEmpty:(NSString *)path { | |
NSFileManager *fileManager = [NSFileManager defaultManager]; | |
if ([[fileManager directoryContentsAtPath:path] count] > 0) | |
return NO; | |
else | |
return YES; | |
} | |
- (BOOL)directoryIsEmpty:(NSString *)path { | |
NSFileManager *fileManager = [NSFileManager defaultManager]; | |
NSError *error = nil; | |
if ([[fileManager contentsOfDirectoryAtPath:path error:&error] count] > 0) | |
return NO; | |
else | |
return YES; | |
} | |
- (void)printDirectoryContents:(NSString *)path { | |
NSFileManager *fileManager = [NSFileManager defaultManager]; | |
NSArray *contents = [fileManager directoryContentsAtPath:path]; | |
for (NSString *directoryItem in contents) { | |
NSLog(@"%@", directoryItem); | |
} | |
} | |
- (void)printDirectoryContents:(NSString *)path { | |
NSFileManager *fileManager = [NSFileManager defaultManager]; | |
NSError *error = nil; | |
NSArray *contents = [fileManager contentsOfDirectoryAtPath:path error:&error]; | |
if (!error) | |
for (NSString *directoryItem in contents) { | |
NSLog(@"%@", directoryItem); | |
} | |
else | |
// Do something with error | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment