OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ui/base/ui_base_paths.h" | 5 #include "ui/base/ui_base_paths.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 break; | 41 break; |
42 // The following are only valid in the development environment, and | 42 // The following are only valid in the development environment, and |
43 // will fail if executed from an installed executable (because the | 43 // will fail if executed from an installed executable (because the |
44 // generated path won't exist). | 44 // generated path won't exist). |
45 case ui::DIR_TEST_DATA: | 45 case ui::DIR_TEST_DATA: |
46 if (!PathService::Get(base::DIR_SOURCE_ROOT, &cur)) | 46 if (!PathService::Get(base::DIR_SOURCE_ROOT, &cur)) |
47 return false; | 47 return false; |
48 cur = cur.Append(FILE_PATH_LITERAL("app")); | 48 cur = cur.Append(FILE_PATH_LITERAL("app")); |
49 cur = cur.Append(FILE_PATH_LITERAL("test")); | 49 cur = cur.Append(FILE_PATH_LITERAL("test")); |
50 cur = cur.Append(FILE_PATH_LITERAL("data")); | 50 cur = cur.Append(FILE_PATH_LITERAL("data")); |
51 if (!file_util::PathExists(cur)) // we don't want to create this | 51 if (!base::PathExists(cur)) // we don't want to create this |
52 return false; | 52 return false; |
53 break; | 53 break; |
54 #if defined(OS_ANDROID) | 54 #if defined(OS_ANDROID) |
55 case ui::DIR_RESOURCE_PAKS_ANDROID: | 55 case ui::DIR_RESOURCE_PAKS_ANDROID: |
56 if (!PathService::Get(base::DIR_ANDROID_APP_DATA, &cur)) | 56 if (!PathService::Get(base::DIR_ANDROID_APP_DATA, &cur)) |
57 return false; | 57 return false; |
58 cur = cur.Append(FILE_PATH_LITERAL("paks")); | 58 cur = cur.Append(FILE_PATH_LITERAL("paks")); |
59 break; | 59 break; |
60 #endif | 60 #endif |
61 default: | 61 default: |
62 return false; | 62 return false; |
63 } | 63 } |
64 | 64 |
65 if (create_dir && !file_util::PathExists(cur) && | 65 if (create_dir && !base::PathExists(cur) && |
66 !file_util::CreateDirectory(cur)) | 66 !file_util::CreateDirectory(cur)) |
67 return false; | 67 return false; |
68 | 68 |
69 *result = cur; | 69 *result = cur; |
70 return true; | 70 return true; |
71 } | 71 } |
72 | 72 |
73 // This cannot be done as a static initializer sadly since Visual Studio will | 73 // This cannot be done as a static initializer sadly since Visual Studio will |
74 // eliminate this object file if there is no direct entry point into it. | 74 // eliminate this object file if there is no direct entry point into it. |
75 void RegisterPathProvider() { | 75 void RegisterPathProvider() { |
76 PathService::RegisterProvider(PathProvider, PATH_START, PATH_END); | 76 PathService::RegisterProvider(PathProvider, PATH_START, PATH_END); |
77 } | 77 } |
78 | 78 |
79 } // namespace ui | 79 } // namespace ui |
OLD | NEW |