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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 // Converts slashes to backslashes for Windows. Keeps the string unchanged | 131 // Converts slashes to backslashes for Windows. Keeps the string unchanged |
132 // for other systems. | 132 // for other systems. |
133 void ConvertPathToSystem(std::string* path); | 133 void ConvertPathToSystem(std::string* path); |
134 std::string PathToSystem(const std::string& path); | 134 std::string PathToSystem(const std::string& path); |
135 | 135 |
136 // Takes a source-absolute path (must begin with "//") and makes it relative | 136 // Takes a source-absolute path (must begin with "//") and makes it relative |
137 // to the given directory, which also must be source-absolute. | 137 // to the given directory, which also must be source-absolute. |
138 std::string RebaseSourceAbsolutePath(const std::string& input, | 138 std::string RebaseSourceAbsolutePath(const std::string& input, |
139 const SourceDir& dest_dir); | 139 const SourceDir& dest_dir); |
140 | 140 |
| 141 // Returns the given directory with no terminating slash at the end, such that |
| 142 // appending a slash and more stuff will produce a valid path. |
| 143 // |
| 144 // If the directory refers to either the source or system root, we'll append |
| 145 // a "." so this remains valid. |
| 146 std::string DirectoryWithNoLastSlash(const SourceDir& dir); |
| 147 |
| 148 // ----------------------------------------------------------------------------- |
| 149 |
| 150 // These functions return the various flavors of output and gen directories. |
| 151 SourceDir GetToolchainOutputDir(const Settings* settings); |
| 152 SourceDir GetToolchainGenDir(const Settings* settings); |
| 153 SourceDir GetOutputDirForSourceDir(const Settings* settings, |
| 154 const SourceDir& source_dir); |
| 155 SourceDir GetGenDirForSourceDir(const Settings* settings, |
| 156 const SourceDir& source_dir); |
| 157 SourceDir GetTargetOutputDir(const Target* target); |
| 158 SourceDir GetTargetGenDir(const Target* target); |
| 159 SourceDir GetCurrentOutputDir(const Scope* scope); |
| 160 SourceDir GetCurrentGenDir(const Scope* scope); |
| 161 |
141 #endif // TOOLS_GN_FILESYSTEM_UTILS_H_ | 162 #endif // TOOLS_GN_FILESYSTEM_UTILS_H_ |
OLD | NEW |