| 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.h" | 5 #include "chrome/common/chrome_paths.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 return PathService::Get(base::FILE_MODULE, result); | 67 return PathService::Get(base::FILE_MODULE, result); |
| 68 } | 68 } |
| 69 | 69 |
| 70 // Assume that we will not need to create the directory if it does not exist. | 70 // Assume that we will not need to create the directory if it does not exist. |
| 71 // This flag can be set to true for the cases where we want to create it. | 71 // This flag can be set to true for the cases where we want to create it. |
| 72 bool create_dir = false; | 72 bool create_dir = false; |
| 73 | 73 |
| 74 FilePath cur; | 74 FilePath cur; |
| 75 switch (key) { | 75 switch (key) { |
| 76 case chrome::DIR_USER_DATA: | 76 case chrome::DIR_USER_DATA: |
| 77 if (!GetDefaultUserDataDirectory(&cur)) | 77 if (!GetDefaultUserDataDirectory(&cur)) { |
| 78 NOTREACHED(); |
| 78 return false; | 79 return false; |
| 80 } |
| 79 create_dir = true; | 81 create_dir = true; |
| 80 break; | 82 break; |
| 81 case chrome::DIR_USER_CACHE: | 83 case chrome::DIR_USER_CACHE: |
| 82 #if defined(OS_LINUX) | 84 #if defined(OS_LINUX) |
| 83 if (!GetUserCacheDirectory(&cur)) | 85 if (!GetUserCacheDirectory(&cur)) |
| 84 return false; | 86 return false; |
| 85 create_dir = true; | 87 create_dir = true; |
| 86 #else | 88 #else |
| 87 // No concept of a separate cache directory on non-Linux systems. | 89 // No concept of a separate cache directory on non-Linux systems. |
| 88 return false; | 90 return false; |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 return true; | 215 return true; |
| 214 } | 216 } |
| 215 | 217 |
| 216 // This cannot be done as a static initializer sadly since Visual Studio will | 218 // This cannot be done as a static initializer sadly since Visual Studio will |
| 217 // eliminate this object file if there is no direct entry point into it. | 219 // eliminate this object file if there is no direct entry point into it. |
| 218 void RegisterPathProvider() { | 220 void RegisterPathProvider() { |
| 219 PathService::RegisterProvider(PathProvider, PATH_START, PATH_END); | 221 PathService::RegisterProvider(PathProvider, PATH_START, PATH_END); |
| 220 } | 222 } |
| 221 | 223 |
| 222 } // namespace chrome | 224 } // namespace chrome |
| OLD | NEW |