blob: 41883d9032c188ecd42d785d6d32235dff212e8f [file] [log] [blame]
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "base/base_paths.h"
#include <stdlib.h>
#include "base/command_line.h"
#include "base/files/file_path.h"
namespace base {
bool PathProviderFuchsia(int key, FilePath* result) {
switch (key) {
// Not supported in debug or component builds. Fall back on using the EXE
// path for now.
// TODO(fuchsia): Get this value from an API. See
case FILE_EXE: {
// Use the binary name as specified on the command line.
// TODO(fuchsia): It would be nice to get the canonical executable path
// from a kernel API. See
char bin_dir[PATH_MAX + 1];
if (realpath(base::CommandLine::ForCurrentProcess()
bin_dir) == NULL) {
return false;
*result = FilePath(bin_dir);
return true;
// This is only used for tests, so we return the binary location for now.
*result = FilePath("/system");
return true;
*result = FilePath("/data");
return true;
return false;
} // namespace base