• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2012 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef BASE_BASE_PATHS_H_
6 #define BASE_BASE_PATHS_H_
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 
11 #include "build/build_config.h"
12 
13 #if BUILDFLAG(IS_WIN)
14 #include "base/base_paths_win.h"
15 #elif BUILDFLAG(IS_APPLE)
16 #include "base/base_paths_mac.h"
17 #elif BUILDFLAG(IS_ANDROID)
18 #include "base/base_paths_android.h"
19 #endif
20 
21 #if BUILDFLAG(IS_POSIX)
22 #include "base/base_paths_posix.h"
23 #endif
24 
25 namespace base {
26 
27 enum BasePathKey {
28   PATH_START = 0,
29 
30   // The following refer to the current application.
31   FILE_EXE,  // Path and filename of the current executable.
32 #if !BUILDFLAG(IS_FUCHSIA)
33   // Prefer keys (e.g., DIR_ASSETS) that are specific to the use case as the
34   // module location may not work as expected on some platforms. For this
35   // reason, this key is not defined on Fuchsia. See crbug.com/1263691 for
36   // details.
37   FILE_MODULE,  // Path and filename of the module containing the code for
38                 // the PathService (which could differ from FILE_EXE if the
39                 // PathService were compiled into a shared object, for
40                 // example).
41 #endif
42   DIR_EXE,  // Directory containing FILE_EXE.
43 #if !BUILDFLAG(IS_FUCHSIA)
44   // Prefer keys (e.g., DIR_ASSETS) that are specific to the use case as the
45   // module location may not work as expected on some platforms. For this
46   // reason, this key is not defined on Fuchsia. See crbug.com/1263691 for
47   // details.
48   DIR_MODULE,  // Directory containing FILE_MODULE.
49 #endif
50   DIR_ASSETS,  // Directory that contains application assets.
51 
52   // The following refer to system and system user directories.
53   DIR_TEMP,          // Temporary directory for the system and/or user.
54   DIR_HOME,          // User's root home directory. On Windows this will look
55                      // like "C:\Users\<user>"  which isn't necessarily a great
56                      // place to put files.
57   DIR_USER_DESKTOP,  // The current user's Desktop.
58 
59   // The following refer to the applications current environment.
60   DIR_CURRENT,  // Current directory.
61 
62   // The following are only for use in tests.
63   // On some platforms, such as Android and Fuchsia, tests do not have access to
64   // the build file system so the necessary files are bundled with the test
65   // binary. On such platforms, these will return an appropriate path inside the
66   // bundle.
67   DIR_SRC_TEST_DATA_ROOT,  // The root of files in the source tree that are
68                            // made available to tests. Useful for tests that use
69                            // resources that exist in the source tree.
70   DIR_SOURCE_ROOT = DIR_SRC_TEST_DATA_ROOT,  // Legacy name still widely used.
71                                              // TODO(crbug.com/1264897): Replace
72                                              // all instances and remove alias.
73   DIR_GEN_TEST_DATA_ROOT,  // The root of files created by the build that are
74                            // made available to tests. On platforms that do
75                            // not bundle test files, this is usually the
76                            // directory containing the test binary.
77   DIR_TEST_DATA,           // Directory containing test data for //base tests.
78                            // Only for use in base_unittests. Equivalent to
79                            // DIR_SRC_TEST_DATA_ROOT + "/base/test/data".
80 
81   PATH_END
82 };
83 
84 }  // namespace base
85 
86 #endif  // BASE_BASE_PATHS_H_
87