aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Foundation/GTMLoggerTest.m4
-rw-r--r--Foundation/GTMNSFileManager+Path.h16
-rw-r--r--Foundation/GTMNSFileManager+Path.m4
-rw-r--r--Foundation/GTMNSFileManager+PathTest.m22
-rw-r--r--Foundation/GTMPath.m2
-rw-r--r--Foundation/GTMPathTest.m62
-rw-r--r--GTM.xcodeproj/project.pbxproj1
7 files changed, 56 insertions, 55 deletions
diff --git a/Foundation/GTMLoggerTest.m b/Foundation/GTMLoggerTest.m
index 36e9a88..3c915c8 100644
--- a/Foundation/GTMLoggerTest.m
+++ b/Foundation/GTMLoggerTest.m
@@ -95,7 +95,7 @@
@"GTMLoggerUnitTest.log"] retain];
STAssertNotNil(path_, nil);
// Make sure we're cleaned up from the last run
-#if GTM_MACOSX_SDK && (MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5)
+#if GTM_MACOS_SDK && (MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5)
[[NSFileManager defaultManager] removeFileAtPath:path_ handler:nil];
#else
[[NSFileManager defaultManager] removeItemAtPath:path_ error:NULL];
@@ -104,7 +104,7 @@
- (void)tearDown {
STAssertNotNil(path_, nil);
-#if GTM_MACOSX_SDK && (MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5)
+#if GTM_MACOS_SDK && (MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5)
[[NSFileManager defaultManager] removeFileAtPath:path_ handler:nil];
#else
[[NSFileManager defaultManager] removeItemAtPath:path_ error:NULL];
diff --git a/Foundation/GTMNSFileManager+Path.h b/Foundation/GTMNSFileManager+Path.h
index 7c12158..80977b3 100644
--- a/Foundation/GTMNSFileManager+Path.h
+++ b/Foundation/GTMNSFileManager+Path.h
@@ -6,9 +6,9 @@
// Licensed under the Apache License, Version 2.0 (the "License"); you may not
// use this file except in compliance with the License. You may obtain a copy
// of the License at
-//
+//
// http://www.apache.org/licenses/LICENSE-2.0
-//
+//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
@@ -22,16 +22,16 @@
/// A few useful methods for dealing with paths.
@interface NSFileManager (GMFileManagerPathAdditions)
-#if GTM_MACOSX_SDK && (MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5)
+#if GTM_MACOS_SDK && (MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5)
-/// For the Unix-y at heart, this is "mkdir -p". It tries to create
+/// For the Unix-y at heart, this is "mkdir -p". It tries to create
/// the directory specified by |path|, and any intervening directories that
/// are needed. Each directory that is created is created with |attributes|
/// (see other NSFileManager doco for the details on |attributes|).
///
/// If you are building for 10.5 or later, you should just use the new api:
/// createDirectoryAtPath:withIntermediateDirectories:attributes:error:
-///
+///
/// Also if you need more control over the creation of paths and their
/// attributes, look into using GTMPath.
///
@@ -47,7 +47,7 @@
- (BOOL)gtm_createFullPathToDirectory:(NSString *)path
attributes:(NSDictionary *)attributes;
-#endif // GTM_MACOSX_SDK && (MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5)
+#endif // GTM_MACOS_SDK && (MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5)
/// Return an the paths for all resources in |directoryPath| that have the
/// |extension| file extension.
@@ -57,7 +57,7 @@
/// If nil, all files are matched.
/// directoryPath - the directory to look in. NOTE: Subdirectories are NOT
/// traversed.
-///
+///
/// Returns:
/// An NSArray of absolute file paths that have |extension|. nil is returned
/// if |directoryPath| doesn't exist or can't be opened, and returns an empty
@@ -66,7 +66,7 @@
- (NSArray *)gtm_filePathsWithExtension:(NSString *)extension
inDirectory:(NSString *)directoryPath;
-/// Same as -filePathsWithExtension:inDirectory: except |extensions| is an
+/// Same as -filePathsWithExtension:inDirectory: except |extensions| is an
/// NSArray of extensions to match.
///
- (NSArray *)gtm_filePathsWithExtensions:(NSArray *)extensions
diff --git a/Foundation/GTMNSFileManager+Path.m b/Foundation/GTMNSFileManager+Path.m
index a22258a..c29697b 100644
--- a/Foundation/GTMNSFileManager+Path.m
+++ b/Foundation/GTMNSFileManager+Path.m
@@ -21,7 +21,7 @@
@implementation NSFileManager (GMFileManagerPathAdditions)
-#if GTM_MACOSX_SDK && (MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5)
+#if GTM_MACOS_SDK && (MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5)
- (BOOL)gtm_createFullPathToDirectory:(NSString *)path
attributes:(NSDictionary *)attributes {
@@ -52,7 +52,7 @@
return YES;
}
-#endif // GTM_MACOSX_SDK && (MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5)
+#endif // GTM_MACOS_SDK && (MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5)
- (NSArray *)gtm_filePathsWithExtension:(NSString *)extension
inDirectory:(NSString *)directoryPath {
diff --git a/Foundation/GTMNSFileManager+PathTest.m b/Foundation/GTMNSFileManager+PathTest.m
index cfcab0c..749c151 100644
--- a/Foundation/GTMNSFileManager+PathTest.m
+++ b/Foundation/GTMNSFileManager+PathTest.m
@@ -30,7 +30,7 @@
- (void)setUp {
// make a directory to scribble in
NSFileManager *fm = [NSFileManager defaultManager];
- baseDir_
+ baseDir_
= [[fm gtm_createTemporaryDirectoryBasedOn:@"GTMNSFileManager_PathTestXXXXXX"]
retain];
}
@@ -53,7 +53,7 @@
}
}
-#if GTM_MACOSX_SDK && (MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5)
+#if GTM_MACOS_SDK && (MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5)
- (void)testCreateFullPathToDirectoryAttributes {
STAssertNotNil(baseDir_, @"setUp failed");
@@ -82,7 +82,7 @@
@"Should have failed when passed (nil)");
}
-#endif // GTM_MACOSX_SDK && (MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5)
+#endif // GTM_MACOS_SDK && (MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5)
- (void)testfilePathsWithExtensionsInDirectory {
STAssertNotNil(baseDir_, @"setUp failed");
@@ -129,9 +129,9 @@
#if GTM_IPHONE_SDK || (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5)
NSError *error = nil;
STAssertTrue([fm createDirectoryAtPath:testDir
- withIntermediateDirectories:YES
- attributes:nil
- error:&error],
+ withIntermediateDirectories:YES
+ attributes:nil
+ error:&error],
@"Can't create %@ (%@)", testDir, error);
#else
STAssertTrue([fm createDirectoryAtPath:testDir attributes:nil], nil);
@@ -238,15 +238,15 @@
NSString *emptyDir = [baseDir_ stringByAppendingPathComponent:@"emptyDir"];
#if GTM_IPHONE_SDK || (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5)
NSError *error = nil;
- STAssertTrue([fm createDirectoryAtPath:emptyDir
- withIntermediateDirectories:YES
- attributes:nil
- error:&error],
+ STAssertTrue([fm createDirectoryAtPath:emptyDir
+ withIntermediateDirectories:YES
+ attributes:nil
+ error:&error],
@"Can't create %@ (%@)", emptyDir, error);
#else
STAssertTrue([fm createDirectoryAtPath:emptyDir attributes:nil], nil);
#endif // MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5
-
+
// single
matches = [fm gtm_filePathsWithExtension:@"txt" inDirectory:emptyDir];
diff --git a/Foundation/GTMPath.m b/Foundation/GTMPath.m
index 2a8c26e..82e993f 100644
--- a/Foundation/GTMPath.m
+++ b/Foundation/GTMPath.m
@@ -77,7 +77,7 @@
- (NSDictionary *)attributes {
NSFileManager *mgr = [NSFileManager defaultManager];
-#if GTM_MACOSX_SDK && (MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5)
+#if GTM_MACOS_SDK && (MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5)
NSDictionary *attributes = [mgr fileAttributesAtPath:fullPath_
traverseLink:NO];
#else
diff --git a/Foundation/GTMPathTest.m b/Foundation/GTMPathTest.m
index 308cc73..54fa83b 100644
--- a/Foundation/GTMPathTest.m
+++ b/Foundation/GTMPathTest.m
@@ -35,9 +35,9 @@
- (void)setUp {
NSFileManager *mgr = [NSFileManager defaultManager];
- testDirectory_
+ testDirectory_
= [[mgr gtm_createTemporaryDirectoryBasedOn:@"GTMPathTestXXXXXX"] retain];
-
+
STAssertNotNil(testDirectory_, nil);
}
@@ -45,7 +45,7 @@
// Make sure it's safe to remove this directory before nuking it.
STAssertNotNil(testDirectory_, nil);
STAssertNotEqualObjects(testDirectory_, @"/", nil);
-#if GTM_MACOSX_SDK && (MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5)
+#if GTM_MACOS_SDK && (MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5)
[[NSFileManager defaultManager] removeFileAtPath:testDirectory_ handler:nil];
#else
[[NSFileManager defaultManager] removeItemAtPath:testDirectory_ error:NULL];
@@ -55,10 +55,10 @@
- (void)testBasicCreation {
GTMPath *path = nil;
-
+
path = [[[GTMPath alloc] init] autorelease];
STAssertNil(path, nil);
-
+
path = [GTMPath pathWithFullPath:@"/"];
STAssertNotNil(path, nil);
STAssertNil([path parent], nil);
@@ -70,16 +70,16 @@
- (void)testRecursiveInitialization {
GTMPath *path = nil;
-
+
path = [GTMPath pathWithFullPath:nil];
STAssertNil(path, nil);
-
+
path = [GTMPath pathWithFullPath:@""];
STAssertNil(path, nil);
-
+
path = [GTMPath pathWithFullPath:@"etc"];
STAssertNil(path, nil);
-
+
path = [GTMPath pathWithFullPath:@"/"];
STAssertNotNil(path, nil);
STAssertNil([path parent], nil);
@@ -87,7 +87,7 @@
STAssertTrue([path isDirectory], nil);
STAssertEqualObjects([path name], @"/", nil);
STAssertEqualObjects([path fullPath], @"/", nil);
-
+
path = [GTMPath pathWithFullPath:@"/etc"];
STAssertNotNil(path, nil);
STAssertEqualObjects([path name], @"etc", nil);
@@ -96,7 +96,7 @@
STAssertFalse([path isRoot], nil);
STAssertNotNil([path parent], nil);
STAssertTrue([[path parent] isRoot], nil);
-
+
path = [GTMPath pathWithFullPath:@"/etc/passwd"];
STAssertNotNil(path, nil);
STAssertEqualObjects([path name], @"passwd", nil);
@@ -107,22 +107,22 @@
STAssertFalse([[path parent] isRoot], nil);
STAssertTrue([[path parent] isDirectory], nil);
STAssertTrue([[[path parent] parent] isRoot], nil);
-
+
STAssertTrue([[path description] length] > 1, nil);
}
- (void)testCreationWithNonExistentPath {
GTMPath *path = nil;
-
+
path = [GTMPath pathWithFullPath:@" "];
STAssertNil(path, nil);
-
+
path = [GTMPath pathWithFullPath:@"/abcxyz"];
STAssertNil(path, nil);
-
+
path = [GTMPath pathWithFullPath:@"/etc/foo"];
STAssertNil(path, nil);
-
+
path = [GTMPath pathWithFullPath:@"/foo/bar/baz"];
STAssertNil(path, nil);
}
@@ -130,11 +130,11 @@
- (void)testDirectoryCreation {
GTMPath *tmp = [GTMPath pathWithFullPath:testDirectory_];
GTMPath *path = nil;
-
+
NSString *fooPath = [[tmp fullPath] stringByAppendingPathComponent:@"foo"];
path = [GTMPath pathWithFullPath:fooPath];
STAssertNil(path, nil);
-
+
path = [tmp createDirectoryName:@"foo" mode:0555];
STAssertNotNil(path, nil);
STAssertEqualObjects([path name], @"foo", nil);
@@ -144,11 +144,11 @@
@"got %o", (int)[[path attributes] filePosixPermissions]);
STAssertTrue([path isDirectory], nil);
STAssertFalse([path isRoot], nil);
-
+
// Trying to create a file where a dir already exists should fail
path = [tmp createFileName:@"foo" mode:0555];
STAssertNil(path, nil);
-
+
// Calling create again should succeed
path = [tmp createDirectoryName:@"foo" mode:0555];
STAssertNotNil(path, nil);
@@ -157,7 +157,7 @@
@"got %o", (int)[[path attributes] filePosixPermissions]);
STAssertTrue([path isDirectory], nil);
STAssertFalse([path isRoot], nil);
-
+
GTMPath *foo = [GTMPath pathWithFullPath:fooPath];
STAssertNotNil(foo, nil);
STAssertEqualObjects([path name], @"foo", nil);
@@ -170,22 +170,22 @@
- (void)testFileCreation {
GTMPath *tmp = [GTMPath pathWithFullPath:testDirectory_];
GTMPath *path = nil;
-
+
NSString *fooPath = [[tmp fullPath] stringByAppendingPathComponent:@"foo"];
path = [GTMPath pathWithFullPath:fooPath];
STAssertNil(path, nil);
-
+
path = [tmp createFileName:@"foo" mode:0555];
STAssertNotNil(path, nil);
STAssertEqualObjects([path name], @"foo", nil);
STAssertTrue([[path attributes] filePosixPermissions] == 0555, nil);
STAssertFalse([path isDirectory], nil);
STAssertFalse([path isRoot], nil);
-
+
// Trying to create a dir where a file already exists should fail.
path = [tmp createDirectoryName:@"foo" mode:0555];
STAssertNil(path, nil);
-
+
// Calling create again should succeed
path = [tmp createFileName:@"foo" mode:0555];
STAssertNotNil(path, nil);
@@ -193,14 +193,14 @@
STAssertTrue([[path attributes] filePosixPermissions] == 0555, nil);
STAssertFalse([path isDirectory], nil);
STAssertFalse([path isRoot], nil);
-
+
GTMPath *foo = [GTMPath pathWithFullPath:fooPath];
STAssertNotNil(foo, nil);
STAssertEqualObjects([path name], @"foo", nil);
STAssertTrue([[path attributes] filePosixPermissions] == 0555, nil);
STAssertFalse([path isDirectory], nil);
STAssertFalse([path isRoot], nil);
-
+
// Make sure we can't create a file/directory rooted off of |foo|, since it's
// not a directory.
path = [foo createFileName:@"bar" mode:0555];
@@ -214,21 +214,21 @@
NSString *fooPath = [[tmp fullPath] stringByAppendingPathComponent:@"foo"];
GTMPath *path = [GTMPath pathWithFullPath:fooPath];
STAssertNil(path, nil);
-
+
path = [[[tmp createDirectoryName:@"foo" mode:0755]
createDirectoryName:@"bar" mode:0756]
createDirectoryName:@"baz" mode:0757];
STAssertNotNil(path, nil);
-
+
// Check "baz"
STAssertEqualObjects([path name], @"baz", nil);
STAssertTrue([[path attributes] filePosixPermissions] == 0757, nil);
-
+
// Check "bar"
path = [path parent];
STAssertEqualObjects([path name], @"bar", nil);
STAssertTrue([[path attributes] filePosixPermissions] == 0756, nil);
-
+
// Check "foo"
path = [path parent];
STAssertEqualObjects([path name], @"foo", nil);
diff --git a/GTM.xcodeproj/project.pbxproj b/GTM.xcodeproj/project.pbxproj
index 84a4c48..d8dd18e 100644
--- a/GTM.xcodeproj/project.pbxproj
+++ b/GTM.xcodeproj/project.pbxproj
@@ -1904,6 +1904,7 @@
isa = PBXProject;
attributes = {
BuildIndependentTargetsInParallel = NO;
+ LastUpgradeCheck = 0430;
};
buildConfigurationList = 1DEB918108733D990010E9CD /* Build configuration list for PBXProject "GTM" */;
compatibilityVersion = "Xcode 3.1";