aboutsummaryrefslogtreecommitdiff
path: root/Foundation/GTMPathTest.m
diff options
context:
space:
mode:
Diffstat (limited to 'Foundation/GTMPathTest.m')
-rw-r--r--Foundation/GTMPathTest.m21
1 files changed, 14 insertions, 7 deletions
diff --git a/Foundation/GTMPathTest.m b/Foundation/GTMPathTest.m
index 211206c..aec0731 100644
--- a/Foundation/GTMPathTest.m
+++ b/Foundation/GTMPathTest.m
@@ -36,9 +36,16 @@
testDirectory_ = [[tmp stringByAppendingPathComponent:@"GTMPathTest"] retain];
STAssertNotNil(testDirectory_, nil);
- BOOL created = [[NSFileManager defaultManager]
- createDirectoryAtPath:testDirectory_
- attributes:nil];
+ BOOL created = NO;
+ NSFileManager *mgr = [NSFileManager defaultManager];
+#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5
+ NSError *error = nil;
+ created = [mgr createDirectoryAtPath:testDirectory_
+ withIntermediateDirectories:YES attributes:nil error:&error];
+ STAssertNil(error, @"Can't create dir at %@ error:%@", testDirectory_, error);
+#else
+ created = [mgr createDirectoryAtPath:testDirectory_ attributes:nil];
+#endif // MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5
STAssertTrue(created, nil);
}
@@ -46,11 +53,11 @@
// Make sure it's safe to remove this directory before nuking it.
STAssertNotNil(testDirectory_, nil);
STAssertNotEqualObjects(testDirectory_, @"/", nil);
-#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5
- [[NSFileManager defaultManager] removeFileAtPath:testDirectory_ handler:nil];
-#else
+#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5
[[NSFileManager defaultManager] removeItemAtPath:testDirectory_ error:NULL];
-#endif
+#else
+ [[NSFileManager defaultManager] removeFileAtPath:testDirectory_ handler:nil];
+#endif // MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5
[testDirectory_ release];
}