Thanks to visit codestin.com
Credit goes to chromium.googlesource.com

blob: c2bf4a2fdb008f7e6bc3fa0158c5ee150d04b89a [file] [log] [blame]
Avi Drissmane4622aa2022-09-08 20:36:061// Copyright 2017 The Chromium Authors
scottmg1ab7aa82017-05-25 05:22:492// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "base/base_paths.h"
6
Kevin Marshallfe2f08c2017-08-25 21:45:297#include <stdlib.h>
8
9#include "base/command_line.h"
Kevin Marshallf35fa5f2018-01-29 19:24:4210#include "base/files/file_util.h"
Sergey Ulanov278b19f2019-03-12 00:19:5911#include "base/fuchsia/file_utils.h"
Peter Boström6e2fd082024-01-23 01:17:5512#include "base/notimplemented.h"
Kevin Marshallf35fa5f2018-01-29 19:24:4213#include "base/path_service.h"
14#include "base/process/process.h"
scottmg1ab7aa82017-05-25 05:22:4915
16namespace base {
Kevin Marshallf35fa5f2018-01-29 19:24:4217
scottmg1ab7aa82017-05-25 05:22:4918bool PathProviderFuchsia(int key, FilePath* result) {
19 switch (key) {
Sergey Ulanov5d0a54c2018-05-11 18:07:4420 case FILE_EXE:
21 *result = CommandLine::ForCurrentProcess()->GetProgram();
Scott Graham4bd2b07f2017-06-01 04:17:0422 return true;
Sergey Ulanovd5ae68e2018-02-07 20:14:2123 case DIR_ASSETS:
David Dorwinc694f722021-10-29 22:46:5924 *result = base::FilePath(base::kPackageRootDirectoryPath);
25 return true;
Etienne Pierre-dorayf4dcbd6a2023-07-06 16:12:0326
Alison Gale81f4f2c72024-04-22 19:33:3127 // TODO(crbug.com/40274404): Align with other platforms and remove this
Etienne Pierre-dorayf4dcbd6a2023-07-06 16:12:0328 // specialization.
David Dorwinc694f722021-10-29 22:46:5929 case DIR_GEN_TEST_DATA_ROOT:
Etienne Pierre-dorayf4dcbd6a2023-07-06 16:12:0330 [[fallthrough]];
31
32 case DIR_SRC_TEST_DATA_ROOT:
33 case DIR_OUT_TEST_DATA_ROOT:
David Dorwinc694f722021-10-29 22:46:5934 // These are only used by tests.
35 // Test binaries are added to the package root via GN deps.
Fabrice de Gans-Riberiee44a3b2020-10-10 00:21:1336 *result = base::FilePath(base::kPackageRootDirectoryPath);
Kevin Marshallf35fa5f2018-01-29 19:24:4237 return true;
David Dorwind9d3c7c2021-10-21 04:50:4938 case DIR_USER_DESKTOP:
Alison Galed965ba02024-04-26 21:50:5439 // TODO(crbug.com/42050322): Implement this case for DIR_USER_DESKTOP.
Keith Leed41880c72022-12-13 02:58:2540 NOTIMPLEMENTED_LOG_ONCE();
David Dorwind9d3c7c2021-10-21 04:50:4941 return false;
42 case DIR_HOME:
Alison Galed965ba02024-04-26 21:50:5443 // TODO(crbug.com/42050322) Provide a proper base::GetHomeDir()
David Dorwind9d3c7c2021-10-21 04:50:4944 // implementation for Fuchsia and remove this case statement. See also
45 // crbug.com/1261284. For now, log, return false, and let the base
46 // implementation handle it. This will end up returning a temporary
47 // directory.
Keith Leed41880c72022-12-13 02:58:2548 // This is for DIR_HOME. Will use temporary dir.
49 NOTIMPLEMENTED_LOG_ONCE();
David Dorwind9d3c7c2021-10-21 04:50:4950 return false;
scottmg1ab7aa82017-05-25 05:22:4951 }
David Dorwinc694f722021-10-29 22:46:5952
scottmg1ab7aa82017-05-25 05:22:4953 return false;
54}
55
56} // namespace base