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