| 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 #include "chrome/common/chrome_paths_internal.h" | 5 #include "chrome/common/chrome_paths_internal.h" |
| 6 | 6 |
| 7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
| 8 | 8 |
| 9 #include "base/base_paths.h" | 9 #include "base/base_paths.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 #endif | 41 #endif |
| 42 success = true; | 42 success = true; |
| 43 } | 43 } |
| 44 return success; | 44 return success; |
| 45 } | 45 } |
| 46 | 46 |
| 47 bool GetUserDocumentsDirectory(FilePath* result) { | 47 bool GetUserDocumentsDirectory(FilePath* result) { |
| 48 return mac_util::GetUserDirectory(NSDocumentDirectory, result); | 48 return mac_util::GetUserDirectory(NSDocumentDirectory, result); |
| 49 } | 49 } |
| 50 | 50 |
| 51 void GetUserCacheDirectory(const FilePath& profile_dir, FilePath* result) { | |
| 52 // If the profile directory is under ~/Library/Application Support, | |
| 53 // use a suitable cache directory under ~/Library/Caches. For | |
| 54 // example, a profile directory of ~/Library/Application | |
| 55 // Support/Google/Chrome/MyProfileName would use the cache directory | |
| 56 // ~/Library/Caches/Google/Chrome/MyProfileName. | |
| 57 | |
| 58 // Default value in cases where any of the following fails. | |
| 59 *result = profile_dir; | |
| 60 | |
| 61 FilePath app_data_dir; | |
| 62 if (!PathService::Get(base::DIR_APP_DATA, &app_data_dir)) | |
| 63 return; | |
| 64 FilePath cache_dir; | |
| 65 if (!PathService::Get(base::DIR_CACHE, &cache_dir)) | |
| 66 return; | |
| 67 if (!app_data_dir.AppendRelativePath(profile_dir, &cache_dir)) | |
| 68 return; | |
| 69 | |
| 70 *result = cache_dir; | |
| 71 } | |
| 72 | |
| 73 bool GetUserDownloadsDirectory(FilePath* result) { | 51 bool GetUserDownloadsDirectory(FilePath* result) { |
| 74 return mac_util::GetUserDirectory(NSDownloadsDirectory, result); | 52 return mac_util::GetUserDirectory(NSDownloadsDirectory, result); |
| 75 } | 53 } |
| 76 | 54 |
| 77 bool GetUserDesktop(FilePath* result) { | 55 bool GetUserDesktop(FilePath* result) { |
| 78 return mac_util::GetUserDirectory(NSDesktopDirectory, result); | 56 return mac_util::GetUserDirectory(NSDesktopDirectory, result); |
| 79 } | 57 } |
| 80 | 58 |
| 81 FilePath GetVersionedDirectory() { | 59 FilePath GetVersionedDirectory() { |
| 82 if (g_override_versioned_directory) | 60 if (g_override_versioned_directory) |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 // The framework bundle is at a known path and name from the browser .app's | 103 // The framework bundle is at a known path and name from the browser .app's |
| 126 // versioned directory. | 104 // versioned directory. |
| 127 return GetVersionedDirectory().Append(kFrameworkName); | 105 return GetVersionedDirectory().Append(kFrameworkName); |
| 128 } | 106 } |
| 129 | 107 |
| 130 bool GetLocalLibraryDirectory(FilePath* result) { | 108 bool GetLocalLibraryDirectory(FilePath* result) { |
| 131 return mac_util::GetLocalDirectory(NSLibraryDirectory, result); | 109 return mac_util::GetLocalDirectory(NSLibraryDirectory, result); |
| 132 } | 110 } |
| 133 | 111 |
| 134 } // namespace chrome | 112 } // namespace chrome |
| OLD | NEW |