Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #import "chrome/common/chrome_paths_internal.h" | 5 #import "chrome/common/chrome_paths_internal.h" |
| 6 | 6 |
| 7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
| 8 | 8 |
| 9 #import "base/base_paths.h" | 9 #import "base/base_paths.h" |
| 10 #import "base/logging.h" | 10 #import "base/logging.h" |
| 11 #import "base/path_service.h" | 11 #import "base/path_service.h" |
| 12 | 12 |
| 13 namespace chrome { | 13 namespace chrome { |
| 14 | 14 |
| 15 bool GetDefaultUserDataDirectory(FilePath* result) { | 15 bool GetDefaultUserDataDirectory(FilePath* result) { |
| 16 bool success = false; | 16 bool success = false; |
| 17 NSArray* dirs = | 17 if (result && PathService::Get(base::DIR_APP_DATA, result)) { |
| 18 NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, | |
| 19 NSUserDomainMask, YES); | |
| 20 if ([dirs count] && result) { | |
| 21 NSString* base = [dirs objectAtIndex:0]; | |
| 22 #if defined(GOOGLE_CHROME_BUILD) | 18 #if defined(GOOGLE_CHROME_BUILD) |
| 23 base = [base stringByAppendingPathComponent:@"Google"]; | 19 *result = result->Append("Google")->Append("Chrome"); |
|
Mark Mentovai
2009/09/16 19:33:27
In a Mac build with GOOGLE_CHROME_BUILD defined:
| |
| 24 NSString* tail = @"Chrome"; | |
| 25 #else | 20 #else |
| 26 NSString* tail = @"Chromium"; | 21 *result = result->Append("Chromium"); |
| 27 #endif | 22 #endif |
| 28 NSString* path = [base stringByAppendingPathComponent:tail]; | |
| 29 *result = FilePath([path fileSystemRepresentation]); | |
| 30 success = true; | 23 success = true; |
| 31 } | 24 } |
| 32 return success; | 25 return success; |
| 33 } | 26 } |
| 34 | 27 |
| 35 bool GetUserDocumentsDirectory(FilePath* result) { | 28 bool GetUserDocumentsDirectory(FilePath* result) { |
| 36 bool success = false; | 29 bool success = false; |
| 37 NSArray* docArray = | 30 NSArray* docArray = |
| 38 NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, | 31 NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, |
| 39 NSUserDomainMask, | 32 NSUserDomainMask, |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 91 [components subarrayWithRange:NSMakeRange(0, [components count] - 3)]; | 84 [components subarrayWithRange:NSMakeRange(0, [components count] - 3)]; |
| 92 | 85 |
| 93 NSString* browser_path = [NSString pathWithComponents:components]; | 86 NSString* browser_path = [NSString pathWithComponents:components]; |
| 94 DCHECK([[browser_path pathExtension] isEqualToString:@"app"]) | 87 DCHECK([[browser_path pathExtension] isEqualToString:@"app"]) |
| 95 << "we weren't within another app?"; | 88 << "we weren't within another app?"; |
| 96 | 89 |
| 97 return FilePath([browser_path fileSystemRepresentation]); | 90 return FilePath([browser_path fileSystemRepresentation]); |
| 98 } | 91 } |
| 99 | 92 |
| 100 } // namespace chrome | 93 } // namespace chrome |
| OLD | NEW |