aboutsummaryrefslogtreecommitdiff
path: root/Foundation/GTMNSFileManager+Path.m
diff options
context:
space:
mode:
Diffstat (limited to 'Foundation/GTMNSFileManager+Path.m')
-rw-r--r--Foundation/GTMNSFileManager+Path.m13
1 files changed, 11 insertions, 2 deletions
diff --git a/Foundation/GTMNSFileManager+Path.m b/Foundation/GTMNSFileManager+Path.m
index 195cd9e..bd0aef9 100644
--- a/Foundation/GTMNSFileManager+Path.m
+++ b/Foundation/GTMNSFileManager+Path.m
@@ -72,15 +72,24 @@
return nil;
// |basenames| will contain only the matching file names, not their full paths.
+ NSError *error = nil;
+#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5
+ NSArray *basenames = [self contentsOfDirectoryAtPath:directoryPath
+ error:&error];
+#else
NSArray *basenames = [self directoryContentsAtPath:directoryPath];
+#endif // MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5
// Check if dir doesn't exist or couldn't be opened.
- if (basenames == nil)
+ if (basenames == nil) {
+ _GTMDevLog(@"Error: %@", error);
return nil;
+ }
// Check if dir is empty.
- if ([basenames count] == 0)
+ if ([basenames count] == 0) {
return basenames;
+ }
NSMutableArray *paths = [NSMutableArray arrayWithCapacity:[basenames count]];
NSString *basename;