Upload upstream chromium 69.0.3497
[platform/framework/web/chromium-efl.git] / base / base_paths_fuchsia.cc
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
5 #include "base/base_paths.h"
6
7 #include <stdlib.h>
8
9 #include "base/base_paths_fuchsia.h"
10 #include "base/command_line.h"
11 #include "base/files/file_util.h"
12 #include "base/path_service.h"
13 #include "base/process/process.h"
14
15 namespace base {
16
17 base::FilePath GetPackageRoot() {
18   return base::FilePath("/pkg");
19 }
20
21 bool PathProviderFuchsia(int key, FilePath* result) {
22   switch (key) {
23     case FILE_MODULE:
24       NOTIMPLEMENTED();
25       return false;
26     case FILE_EXE:
27       *result = CommandLine::ForCurrentProcess()->GetProgram();
28       return true;
29     case DIR_APP_DATA:
30       // TODO(https://crbug.com/840598): Switch to /data when minfs supports
31       // mmap().
32       DLOG(WARNING) << "Using /tmp as app data dir, changes will NOT be "
33                        "persisted! (crbug.com/840598)";
34       *result = FilePath("/tmp");
35       return true;
36     case DIR_CACHE:
37       *result = FilePath("/data");
38       return true;
39     case DIR_ASSETS:
40     case DIR_SOURCE_ROOT:
41       *result = GetPackageRoot();
42       return true;
43   }
44   return false;
45 }
46
47 }  // namespace base