| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 #ifndef TOOLS_GN_FILESYSTEM_UTILS_H_ | 5 #ifndef TOOLS_GN_FILESYSTEM_UTILS_H_ |
| 6 #define TOOLS_GN_FILESYSTEM_UTILS_H_ | 6 #define TOOLS_GN_FILESYSTEM_UTILS_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 std::string* dest); | 128 std::string* dest); |
| 129 | 129 |
| 130 // Converts a directory to its inverse (e.g. "/foo/bar/" -> "../../"). | 130 // Converts a directory to its inverse (e.g. "/foo/bar/" -> "../../"). |
| 131 // This will be the empty string for the root directories ("/" and "//"), and | 131 // This will be the empty string for the root directories ("/" and "//"), and |
| 132 // in all other cases, this is guaranteed to end in a slash. | 132 // in all other cases, this is guaranteed to end in a slash. |
| 133 std::string InvertDir(const SourceDir& dir); | 133 std::string InvertDir(const SourceDir& dir); |
| 134 | 134 |
| 135 // Collapses "." and sequential "/"s and evaluates "..". | 135 // Collapses "." and sequential "/"s and evaluates "..". |
| 136 void NormalizePath(std::string* path); | 136 void NormalizePath(std::string* path); |
| 137 | 137 |
| 138 // Converts slashes to backslashes for Windows. Keeps the string unchanged | |
| 139 // for other systems. | |
| 140 void ConvertPathToSystem(std::string* path); | |
| 141 std::string PathToSystem(const std::string& path); | |
| 142 | |
| 143 // Takes a source-absolute path (must begin with "//") and makes it relative | 138 // Takes a source-absolute path (must begin with "//") and makes it relative |
| 144 // to the given directory, which also must be source-absolute. | 139 // to the given directory, which also must be source-absolute. |
| 145 std::string RebaseSourceAbsolutePath(const std::string& input, | 140 std::string RebaseSourceAbsolutePath(const std::string& input, |
| 146 const SourceDir& dest_dir); | 141 const SourceDir& dest_dir); |
| 147 | 142 |
| 148 // Returns the given directory with no terminating slash at the end, such that | 143 // Returns the given directory with no terminating slash at the end, such that |
| 149 // appending a slash and more stuff will produce a valid path. | 144 // appending a slash and more stuff will produce a valid path. |
| 150 // | 145 // |
| 151 // If the directory refers to either the source or system root, we'll append | 146 // If the directory refers to either the source or system root, we'll append |
| 152 // a "." so this remains valid. | 147 // a "." so this remains valid. |
| (...skipping 18 matching lines...) Expand all Loading... |
| 171 SourceDir GetOutputDirForSourceDir(const Settings* settings, | 166 SourceDir GetOutputDirForSourceDir(const Settings* settings, |
| 172 const SourceDir& source_dir); | 167 const SourceDir& source_dir); |
| 173 SourceDir GetGenDirForSourceDir(const Settings* settings, | 168 SourceDir GetGenDirForSourceDir(const Settings* settings, |
| 174 const SourceDir& source_dir); | 169 const SourceDir& source_dir); |
| 175 SourceDir GetTargetOutputDir(const Target* target); | 170 SourceDir GetTargetOutputDir(const Target* target); |
| 176 SourceDir GetTargetGenDir(const Target* target); | 171 SourceDir GetTargetGenDir(const Target* target); |
| 177 SourceDir GetCurrentOutputDir(const Scope* scope); | 172 SourceDir GetCurrentOutputDir(const Scope* scope); |
| 178 SourceDir GetCurrentGenDir(const Scope* scope); | 173 SourceDir GetCurrentGenDir(const Scope* scope); |
| 179 | 174 |
| 180 #endif // TOOLS_GN_FILESYSTEM_UTILS_H_ | 175 #endif // TOOLS_GN_FILESYSTEM_UTILS_H_ |
| OLD | NEW |