aboutsummaryrefslogtreecommitdiff
path: root/Foundation/GTMNSFileManager+PathTest.m
diff options
context:
space:
mode:
authorGravatar gtm.daemon <gtm.daemon@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3>2010-07-26 17:00:52 +0000
committerGravatar gtm.daemon <gtm.daemon@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3>2010-07-26 17:00:52 +0000
commit5d588c34c079b3ac0333c2ef5eed6efb76b31b88 (patch)
tree294488e6da48402e4276603ef3853f39f67b9aaf /Foundation/GTMNSFileManager+PathTest.m
parent4d56ee54c0f2b36d0e96db4a74e1b84d539df29d (diff)
[Author: dmaclach]
Added GTMNSFileHandle+UniqueName for easily and safely creating temporary files and unique directory names. Modified some tests to use the new calls. R=thomasvl DELTA=420 (397 added, 16 deleted, 7 changed)
Diffstat (limited to 'Foundation/GTMNSFileManager+PathTest.m')
-rw-r--r--Foundation/GTMNSFileManager+PathTest.m19
1 files changed, 4 insertions, 15 deletions
diff --git a/Foundation/GTMNSFileManager+PathTest.m b/Foundation/GTMNSFileManager+PathTest.m
index 2ce8683..db51c9b 100644
--- a/Foundation/GTMNSFileManager+PathTest.m
+++ b/Foundation/GTMNSFileManager+PathTest.m
@@ -18,6 +18,7 @@
#import "GTMSenTestCase.h"
#import "GTMNSFileManager+Path.h"
+#import "GTMNSFileHandle+UniqueName.h"
@interface GTMNSFileManager_PathTest : GTMTestCase {
NSString *baseDir_;
@@ -28,22 +29,10 @@
- (void)setUp {
// make a directory to scribble in
- NSString *base = NSTemporaryDirectory();
- base = [base stringByAppendingPathComponent:@"GTMNSFileManager_PathTest"];
NSFileManager *fm = [NSFileManager defaultManager];
- STAssertFalse([fm fileExistsAtPath:base], @"File exists at %@", base);
-#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5
- NSError *error = nil;
- STAssertTrue([fm createDirectoryAtPath:base
- withIntermediateDirectories:YES
- attributes:nil
- error:&error],
- @"Unable to create %@: %@", base, error);
-#else
- STAssertTrue([fm createDirectoryAtPath:base attributes:nil],
- @"Unable to create %@", base);
-#endif
- baseDir_ = [base retain];
+ baseDir_
+ = [[fm gtm_createTemporaryDirectoryBasedOn:@"GTMNSFileManager_PathTestXXXXXX"]
+ retain];
}
- (void)tearDown {