OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_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" |
11 #include "base/path_service.h" | 11 #include "base/path_service.h" |
(...skipping 13 matching lines...) Expand all Loading... |
25 #if defined(OS_MACOSX) | 25 #if defined(OS_MACOSX) |
26 // On Mac, locale files are in Contents/Resources, a sibling of the | 26 // On Mac, locale files are in Contents/Resources, a sibling of the |
27 // App dir. | 27 // App dir. |
28 cur = cur.DirName(); | 28 cur = cur.DirName(); |
29 cur = cur.Append(FILE_PATH_LITERAL("Resources")); | 29 cur = cur.Append(FILE_PATH_LITERAL("Resources")); |
30 #else | 30 #else |
31 cur = cur.Append(FILE_PATH_LITERAL("locales")); | 31 cur = cur.Append(FILE_PATH_LITERAL("locales")); |
32 #endif | 32 #endif |
33 create_dir = true; | 33 create_dir = true; |
34 break; | 34 break; |
| 35 case ui::FILE_RESOURCES_PAK: |
| 36 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
| 37 if (!PathService::Get(base::DIR_EXE, &cur)) |
| 38 return false; |
| 39 // TODO(tony): We shouldn't be referencing chrome here. |
| 40 cur = cur.AppendASCII("chrome.pak"); |
| 41 #else |
| 42 NOTREACHED(); |
| 43 #endif |
| 44 break; |
35 // The following are only valid in the development environment, and | 45 // The following are only valid in the development environment, and |
36 // will fail if executed from an installed executable (because the | 46 // will fail if executed from an installed executable (because the |
37 // generated path won't exist). | 47 // generated path won't exist). |
38 case ui::DIR_TEST_DATA: | 48 case ui::DIR_TEST_DATA: |
39 if (!PathService::Get(base::DIR_SOURCE_ROOT, &cur)) | 49 if (!PathService::Get(base::DIR_SOURCE_ROOT, &cur)) |
40 return false; | 50 return false; |
41 cur = cur.Append(FILE_PATH_LITERAL("app")); | 51 cur = cur.Append(FILE_PATH_LITERAL("app")); |
42 cur = cur.Append(FILE_PATH_LITERAL("test")); | 52 cur = cur.Append(FILE_PATH_LITERAL("test")); |
43 cur = cur.Append(FILE_PATH_LITERAL("data")); | 53 cur = cur.Append(FILE_PATH_LITERAL("data")); |
44 if (!file_util::PathExists(cur)) // we don't want to create this | 54 if (!file_util::PathExists(cur)) // we don't want to create this |
(...skipping 11 matching lines...) Expand all Loading... |
56 return true; | 66 return true; |
57 } | 67 } |
58 | 68 |
59 // This cannot be done as a static initializer sadly since Visual Studio will | 69 // This cannot be done as a static initializer sadly since Visual Studio will |
60 // eliminate this object file if there is no direct entry point into it. | 70 // eliminate this object file if there is no direct entry point into it. |
61 void RegisterPathProvider() { | 71 void RegisterPathProvider() { |
62 PathService::RegisterProvider(PathProvider, PATH_START, PATH_END); | 72 PathService::RegisterProvider(PathProvider, PATH_START, PATH_END); |
63 } | 73 } |
64 | 74 |
65 } // namespace ui | 75 } // namespace ui |
OLD | NEW |