base_paths.h 3.6 KB

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