base_paths_fuchsia.cc 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. // Copyright 2017 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. #include "base/base_paths.h"
  5. #include <stdlib.h>
  6. #include "base/command_line.h"
  7. #include "base/files/file_util.h"
  8. #include "base/fuchsia/file_utils.h"
  9. #include "base/notreached.h"
  10. #include "base/path_service.h"
  11. #include "base/process/process.h"
  12. namespace base {
  13. bool PathProviderFuchsia(int key, FilePath* result) {
  14. switch (key) {
  15. case FILE_EXE:
  16. *result = CommandLine::ForCurrentProcess()->GetProgram();
  17. return true;
  18. case DIR_ASSETS:
  19. *result = base::FilePath(base::kPackageRootDirectoryPath);
  20. return true;
  21. case DIR_SRC_TEST_DATA_ROOT:
  22. case DIR_GEN_TEST_DATA_ROOT:
  23. // These are only used by tests.
  24. // Test binaries are added to the package root via GN deps.
  25. *result = base::FilePath(base::kPackageRootDirectoryPath);
  26. return true;
  27. case DIR_USER_DESKTOP:
  28. // TODO(crbug.com/1231928): Implement this case.
  29. NOTIMPLEMENTED_LOG_ONCE() << " for DIR_USER_DESKTOP.";
  30. return false;
  31. case DIR_HOME:
  32. // TODO(crbug.com/1231928) Provide a proper base::GetHomeDir()
  33. // implementation for Fuchsia and remove this case statement. See also
  34. // crbug.com/1261284. For now, log, return false, and let the base
  35. // implementation handle it. This will end up returning a temporary
  36. // directory.
  37. NOTIMPLEMENTED_LOG_ONCE() << "for DIR_HOME. Will use temporary dir.";
  38. return false;
  39. }
  40. return false;
  41. }
  42. } // namespace base