Avi Drissman | e4622aa | 2022-09-08 20:36:06 | [diff] [blame] | 1 | // Copyright 2012 The Chromium Authors |
license.bot | bf09a50 | 2008-08-24 00:55:55 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
initial.commit | d7cae12 | 2008-07-26 21:49:38 | [diff] [blame] | 4 | |
[email protected] | 5af2edb9 | 2008-08-08 20:16:08 | [diff] [blame] | 5 | #ifndef BASE_BASE_PATHS_H_ |
| 6 | #define BASE_BASE_PATHS_H_ |
initial.commit | d7cae12 | 2008-07-26 21:49:38 | [diff] [blame] | 7 | |
| 8 | // This file declares path keys for the base module. These can be used with |
| 9 | // the PathService to access various special directories and files. |
| 10 | |
[email protected] | 2edc286 | 2011-04-04 18:04:37 | [diff] [blame] | 11 | #include "build/build_config.h" |
| 12 | |
Xiaohan Wang | 38e4ebb | 2022-01-19 06:57:43 | [diff] [blame] | 13 | #if BUILDFLAG(IS_WIN) |
[email protected] | ac510e1 | 2008-08-05 19:46:31 | [diff] [blame] | 14 | #include "base/base_paths_win.h" |
Sylvain Defresne | a9ffa99 | 2023-06-19 09:29:06 | [diff] [blame] | 15 | #elif BUILDFLAG(IS_MAC) |
[email protected] | 5af2edb9 | 2008-08-08 20:16:08 | [diff] [blame] | 16 | #include "base/base_paths_mac.h" |
Sylvain Defresne | a9ffa99 | 2023-06-19 09:29:06 | [diff] [blame] | 17 | #elif BUILDFLAG(IS_IOS) |
| 18 | #include "base/base_paths_ios.h" |
Xiaohan Wang | 38e4ebb | 2022-01-19 06:57:43 | [diff] [blame] | 19 | #elif BUILDFLAG(IS_ANDROID) |
[email protected] | b311178 | 2012-03-22 21:44:31 | [diff] [blame] | 20 | #include "base/base_paths_android.h" |
[email protected] | ac510e1 | 2008-08-05 19:46:31 | [diff] [blame] | 21 | #endif |
| 22 | |
Xiaohan Wang | 38e4ebb | 2022-01-19 06:57:43 | [diff] [blame] | 23 | #if BUILDFLAG(IS_POSIX) |
[email protected] | dea1d7d | 2012-09-20 16:24:52 | [diff] [blame] | 24 | #include "base/base_paths_posix.h" |
| 25 | #endif |
| 26 | |
initial.commit | d7cae12 | 2008-07-26 21:49:38 | [diff] [blame] | 27 | namespace base { |
| 28 | |
[email protected] | d643172 | 2011-09-01 00:46:33 | [diff] [blame] | 29 | enum BasePathKey { |
initial.commit | d7cae12 | 2008-07-26 21:49:38 | [diff] [blame] | 30 | PATH_START = 0, |
| 31 | |
David Dorwin | 15b9e166 | 2021-11-04 19:45:05 | [diff] [blame] | 32 | // The following refer to the current application. |
Mason Bendixen | d798600c | 2021-11-23 19:50:42 | [diff] [blame] | 33 | FILE_EXE, // Path and filename of the current executable. |
Sylvain Defresne | e7b6655 | 2023-06-20 08:23:30 | [diff] [blame] | 34 | #if !BUILDFLAG(IS_FUCHSIA) && !BUILDFLAG(IS_IOS) |
Mason Bendixen | d798600c | 2021-11-23 19:50:42 | [diff] [blame] | 35 | // Prefer keys (e.g., DIR_ASSETS) that are specific to the use case as the |
| 36 | // module location may not work as expected on some platforms. For this |
| 37 | // reason, this key is not defined on Fuchsia. See crbug.com/1263691 for |
| 38 | // details. |
David Dorwin | 15b9e166 | 2021-11-04 19:45:05 | [diff] [blame] | 39 | FILE_MODULE, // Path and filename of the module containing the code for |
| 40 | // the PathService (which could differ from FILE_EXE if the |
| 41 | // PathService were compiled into a shared object, for |
| 42 | // example). |
Mason Bendixen | d798600c | 2021-11-23 19:50:42 | [diff] [blame] | 43 | #endif |
| 44 | DIR_EXE, // Directory containing FILE_EXE. |
Sylvain Defresne | e7b6655 | 2023-06-20 08:23:30 | [diff] [blame] | 45 | #if !BUILDFLAG(IS_FUCHSIA) && !BUILDFLAG(IS_IOS) |
Mason Bendixen | d798600c | 2021-11-23 19:50:42 | [diff] [blame] | 46 | // Prefer keys (e.g., DIR_ASSETS) that are specific to the use case as the |
| 47 | // module location may not work as expected on some platforms. For this |
| 48 | // reason, this key is not defined on Fuchsia. See crbug.com/1263691 for |
| 49 | // details. |
| 50 | DIR_MODULE, // Directory containing FILE_MODULE. |
| 51 | #endif |
| 52 | DIR_ASSETS, // Directory that contains application assets. |
David Dorwin | 15b9e166 | 2021-11-04 19:45:05 | [diff] [blame] | 53 | |
| 54 | // The following refer to system and system user directories. |
Etienne Pierre-doray | f4dcbd6a | 2023-07-06 16:12:03 | [diff] [blame] | 55 | DIR_TEMP, // Temporary directory for the system and/or user. |
| 56 | DIR_HOME, // User's root home directory. On Windows this will look |
| 57 | // like "C:\Users\<user>" which isn't necessarily a great |
| 58 | // place to put files. |
Sylvain Defresne | e7b6655 | 2023-06-20 08:23:30 | [diff] [blame] | 59 | #if !BUILDFLAG(IS_IOS) |
David Dorwin | c694f72 | 2021-10-29 22:46:59 | [diff] [blame] | 60 | DIR_USER_DESKTOP, // The current user's Desktop. |
Sylvain Defresne | e7b6655 | 2023-06-20 08:23:30 | [diff] [blame] | 61 | #endif |
David Dorwin | 15b9e166 | 2021-11-04 19:45:05 | [diff] [blame] | 62 | |
| 63 | // The following refer to the applications current environment. |
| 64 | DIR_CURRENT, // Current directory. |
[email protected] | 5d1937bb | 2009-11-21 01:29:00 | [diff] [blame] | 65 | |
David Dorwin | c694f72 | 2021-10-29 22:46:59 | [diff] [blame] | 66 | // The following are only for use in tests. |
| 67 | // On some platforms, such as Android and Fuchsia, tests do not have access to |
| 68 | // the build file system so the necessary files are bundled with the test |
| 69 | // binary. On such platforms, these will return an appropriate path inside the |
| 70 | // bundle. |
| 71 | DIR_SRC_TEST_DATA_ROOT, // The root of files in the source tree that are |
| 72 | // made available to tests. Useful for tests that use |
| 73 | // resources that exist in the source tree. |
Paul Semel | f90c9dc5 | 2023-11-03 12:19:56 | [diff] [blame] | 74 | // On posix and windows platform, this can be |
| 75 | // overridden using the CR_SOURCE_ROOT environment |
| 76 | // variable. If it contains a relative path, it will |
| 77 | // be appended to the DIR_EXE directory path. |
Etienne Pierre-doray | f4dcbd6a | 2023-07-06 16:12:03 | [diff] [blame] | 78 | DIR_OUT_TEST_DATA_ROOT, // Path of build outputs available to tests. Build |
| 79 | // output files are normally placed directly in the |
| 80 | // build output directory on platforms that do not |
| 81 | // "package" tests. On platforms that "package" |
| 82 | // tests this will instead return a package-local |
| 83 | // path to copies of the relevant files. |
| 84 | DIR_GEN_TEST_DATA_ROOT, // Path of generated intermediate files available to |
| 85 | // tests. Build-intermediate files are normally |
| 86 | // placed in the "gen" sub-directory of the build |
| 87 | // output directory. On platforms that "package" |
| 88 | // tests this will instead return a package-local |
| 89 | // path to copies of the relevant files. |
David Dorwin | c694f72 | 2021-10-29 22:46:59 | [diff] [blame] | 90 | DIR_TEST_DATA, // Directory containing test data for //base tests. |
David Dorwin | 15b9e166 | 2021-11-04 19:45:05 | [diff] [blame] | 91 | // Only for use in base_unittests. Equivalent to |
| 92 | // DIR_SRC_TEST_DATA_ROOT + "/base/test/data". |
[email protected] | c4803e43 | 2013-03-28 00:40:04 | [diff] [blame] | 93 | |
initial.commit | d7cae12 | 2008-07-26 21:49:38 | [diff] [blame] | 94 | PATH_END |
| 95 | }; |
| 96 | |
| 97 | } // namespace base |
| 98 | |
[email protected] | 5af2edb9 | 2008-08-08 20:16:08 | [diff] [blame] | 99 | #endif // BASE_BASE_PATHS_H_ |