| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "components/filesystem/file_system_app.h" | 5 #include "components/filesystem/file_system_app.h" |
| 6 | 6 |
| 7 #include <memory> |
| 8 |
| 7 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 8 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| 9 #include "base/files/file_util.h" | 11 #include "base/files/file_util.h" |
| 10 #include "services/shell/public/cpp/connection.h" | 12 #include "services/shell/public/cpp/connection.h" |
| 11 #include "services/shell/public/cpp/connector.h" | 13 #include "services/shell/public/cpp/connector.h" |
| 12 | 14 |
| 13 #if defined(OS_WIN) | 15 #if defined(OS_WIN) |
| 14 #include "base/base_paths_win.h" | 16 #include "base/base_paths_win.h" |
| 15 #include "base/path_service.h" | 17 #include "base/path_service.h" |
| 16 #include "base/strings/utf_string_conversions.h" | 18 #include "base/strings/utf_string_conversions.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 if (command_line->HasSwitch(kUserDataDir)) { | 65 if (command_line->HasSwitch(kUserDataDir)) { |
| 64 path = command_line->GetSwitchValuePath(kUserDataDir); | 66 path = command_line->GetSwitchValuePath(kUserDataDir); |
| 65 } else { | 67 } else { |
| 66 #if defined(OS_WIN) | 68 #if defined(OS_WIN) |
| 67 CHECK(PathService::Get(base::DIR_LOCAL_APP_DATA, &path)); | 69 CHECK(PathService::Get(base::DIR_LOCAL_APP_DATA, &path)); |
| 68 #elif defined(OS_MACOSX) | 70 #elif defined(OS_MACOSX) |
| 69 CHECK(PathService::Get(base::DIR_APP_DATA, &path)); | 71 CHECK(PathService::Get(base::DIR_APP_DATA, &path)); |
| 70 #elif defined(OS_ANDROID) | 72 #elif defined(OS_ANDROID) |
| 71 CHECK(PathService::Get(base::DIR_ANDROID_APP_DATA, &path)); | 73 CHECK(PathService::Get(base::DIR_ANDROID_APP_DATA, &path)); |
| 72 #elif defined(OS_LINUX) | 74 #elif defined(OS_LINUX) |
| 73 scoped_ptr<base::Environment> env(base::Environment::Create()); | 75 std::unique_ptr<base::Environment> env(base::Environment::Create()); |
| 74 path = base::nix::GetXDGDirectory(env.get(), | 76 path = base::nix::GetXDGDirectory(env.get(), |
| 75 base::nix::kXdgConfigHomeEnvVar, | 77 base::nix::kXdgConfigHomeEnvVar, |
| 76 base::nix::kDotConfigDir); | 78 base::nix::kDotConfigDir); |
| 77 #else | 79 #else |
| 78 NOTIMPLEMENTED(); | 80 NOTIMPLEMENTED(); |
| 79 #endif | 81 #endif |
| 80 path = path.Append(FILE_PATH_LITERAL("filesystem")); | 82 path = path.Append(FILE_PATH_LITERAL("filesystem")); |
| 81 } | 83 } |
| 82 | 84 |
| 83 if (!base::PathExists(path)) | 85 if (!base::PathExists(path)) |
| 84 base::CreateDirectory(path); | 86 base::CreateDirectory(path); |
| 85 | 87 |
| 86 return path; | 88 return path; |
| 87 } | 89 } |
| 88 | 90 |
| 89 } // namespace filesystem | 91 } // namespace filesystem |
| OLD | NEW |