aboutsummaryrefslogtreecommitdiff
path: root/src/client/mac
diff options
context:
space:
mode:
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];
}
//=============================================================================