aboutsummaryrefslogtreecommitdiff
path: root/src/client/mac
diff options
context:
space:
mode:
authormark@chromium.org <mark@chromium.org@4c0a9323-5329-0410-9bdc-e9ce6186880e>2012-02-09 20:31:08 +0000
committermark@chromium.org <mark@chromium.org@4c0a9323-5329-0410-9bdc-e9ce6186880e>2012-02-09 20:31:08 +0000
commit8e3dcd5a02fc541b23687812fb19afa724e776c1 (patch)
tree79db7dd5a3ea296ab77fb5fe8229a8b0d98ac260 /src/client/mac
parentFix clang warning about format string. (diff)
downloadbreakpad-8e3dcd5a02fc541b23687812fb19afa724e776c1.tar.xz
createDirectoryAtPath:attributes: is deprecated, use the suggested (10.5+)
replacement. Patch by Nico Weber <thakis@chromium.org> Review URL: https://breakpad.appspot.com/349001/ git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@915 4c0a9323-5329-0410-9bdc-e9ce6186880e
Diffstat (limited to 'src/client/mac')
-rw-r--r--src/client/mac/crash_generation/ConfigFile.mm49
1 files changed, 4 insertions, 45 deletions
diff --git a/src/client/mac/crash_generation/ConfigFile.mm b/src/client/mac/crash_generation/ConfigFile.mm
index 315d07f9..b5e918df 100644
--- a/src/client/mac/crash_generation/ConfigFile.mm
+++ b/src/client/mac/crash_generation/ConfigFile.mm
@@ -55,55 +55,14 @@ namespace google_breakpad {
BOOL EnsureDirectoryPathExists(NSString *dirPath) {
NSFileManager *mgr = [NSFileManager defaultManager];
- // If we got a relative path, prepend the current directory
- if (![dirPath isAbsolutePath])
- dirPath =
- [[mgr currentDirectoryPath] stringByAppendingPathComponent:dirPath];
-
- NSString *path = dirPath;
-
- // Ensure that no file exists within the path which would block creation
- while (1) {
- BOOL isDir;
- if ([mgr fileExistsAtPath:path isDirectory:&isDir]) {
- if (isDir)
- break;
-
- return NO;
- }
-
- path = [path stringByDeletingLastPathComponent];
- }
-
- // Path now contains the first valid directory (or is empty)
- if (![path length])
- return NO;
-
- NSString *common =
- [dirPath commonPrefixWithString:path options:NSLiteralSearch];
-
- // If everything is good
- if ([common isEqualToString:dirPath])
- return YES;
-
- // Break up the difference into components
- NSString *diff = [dirPath substringFromIndex:[common length] + 1];
- NSArray *components = [diff pathComponents];
- NSUInteger count = [components count];
-
- // Rebuild the path one component at a time
NSDictionary *attrs =
[NSDictionary dictionaryWithObject:[NSNumber numberWithUnsignedLong:0750]
forKey:NSFilePosixPermissions];
- path = common;
- for (NSUInteger i = 0; i < count; ++i) {
- path = [path stringByAppendingPathComponent:[components objectAtIndex:i]];
-
- if (![mgr createDirectoryAtPath:path attributes:attrs])
- return NO;
- }
- return YES;
+ return [mgr createDirectoryAtPath:dirPath
+ withIntermediateDirectories:YES
+ attributes:attrs
+ error:nil];
}
//=============================================================================