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 bool 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 FilePath cache_dir; | |
59 if (!mac_util::GetUserDirectory(NSCachesDirectory, &cache_dir)) | |
60 return false; | |
61 | |
62 FilePath app_data_dir; | |
63 if (PathService::Get(base::DIR_APP_DATA, &app_data_dir)) { | |
64 FilePath system_relative_dir = cache_dir; | |
Mark Mentovai
2010/11/18 16:54:54
Do you need this copy? Why don’t you just move the
Evan Martin
2010/11/18 18:13:07
I found the usage of AppendRelativePath kind of ha
| |
65 if (app_data_dir.AppendRelativePath(profile_dir, &system_relative_dir)) { | |
66 *result = system_relative_dir; | |
67 return true; | |
68 } | |
69 } | |
70 | |
71 *result = profile_dir; | |
72 return true; | |
73 } | |
74 | |
51 bool GetUserDownloadsDirectory(FilePath* result) { | 75 bool GetUserDownloadsDirectory(FilePath* result) { |
52 return mac_util::GetUserDirectory(NSDownloadsDirectory, result); | 76 return mac_util::GetUserDirectory(NSDownloadsDirectory, result); |
53 } | 77 } |
54 | 78 |
55 bool GetUserDesktop(FilePath* result) { | 79 bool GetUserDesktop(FilePath* result) { |
56 return mac_util::GetUserDirectory(NSDesktopDirectory, result); | 80 return mac_util::GetUserDirectory(NSDesktopDirectory, result); |
57 } | 81 } |
58 | 82 |
59 FilePath GetVersionedDirectory() { | 83 FilePath GetVersionedDirectory() { |
60 if (g_override_versioned_directory) | 84 if (g_override_versioned_directory) |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
103 // The framework bundle is at a known path and name from the browser .app's | 127 // The framework bundle is at a known path and name from the browser .app's |
104 // versioned directory. | 128 // versioned directory. |
105 return GetVersionedDirectory().Append(kFrameworkName); | 129 return GetVersionedDirectory().Append(kFrameworkName); |
106 } | 130 } |
107 | 131 |
108 bool GetLocalLibraryDirectory(FilePath* result) { | 132 bool GetLocalLibraryDirectory(FilePath* result) { |
109 return mac_util::GetLocalDirectory(NSLibraryDirectory, result); | 133 return mac_util::GetLocalDirectory(NSLibraryDirectory, result); |
110 } | 134 } |
111 | 135 |
112 } // namespace chrome | 136 } // namespace chrome |
OLD | NEW |