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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 | 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. | 142 // appending a slash and more stuff will produce a valid path. |
143 // | 143 // |
144 // If the directory refers to either the source or system root, we'll append | 144 // If the directory refers to either the source or system root, we'll append |
145 // a "." so this remains valid. | 145 // a "." so this remains valid. |
146 std::string DirectoryWithNoLastSlash(const SourceDir& dir); | 146 std::string DirectoryWithNoLastSlash(const SourceDir& dir); |
147 | 147 |
| 148 // Returns the "best" SourceDir representing the given path. If it's inside the |
| 149 // given source_root, a source-relative directory will be returned (e.g. |
| 150 // "//foo/bar.cc". If it's outside of the source root, a system-absolute |
| 151 // directory will be returned. |
| 152 SourceDir SourceDirForPath(const base::FilePath& source_root, |
| 153 const base::FilePath& path); |
| 154 |
| 155 // Like SourceDirForPath but returns the SourceDir representing the current |
| 156 // directory. |
| 157 SourceDir SourceDirForCurrentDirectory(const base::FilePath& source_root); |
| 158 |
148 // ----------------------------------------------------------------------------- | 159 // ----------------------------------------------------------------------------- |
149 | 160 |
150 // These functions return the various flavors of output and gen directories. | 161 // These functions return the various flavors of output and gen directories. |
151 SourceDir GetToolchainOutputDir(const Settings* settings); | 162 SourceDir GetToolchainOutputDir(const Settings* settings); |
152 SourceDir GetToolchainGenDir(const Settings* settings); | 163 SourceDir GetToolchainGenDir(const Settings* settings); |
153 SourceDir GetOutputDirForSourceDir(const Settings* settings, | 164 SourceDir GetOutputDirForSourceDir(const Settings* settings, |
154 const SourceDir& source_dir); | 165 const SourceDir& source_dir); |
155 SourceDir GetGenDirForSourceDir(const Settings* settings, | 166 SourceDir GetGenDirForSourceDir(const Settings* settings, |
156 const SourceDir& source_dir); | 167 const SourceDir& source_dir); |
157 SourceDir GetTargetOutputDir(const Target* target); | 168 SourceDir GetTargetOutputDir(const Target* target); |
158 SourceDir GetTargetGenDir(const Target* target); | 169 SourceDir GetTargetGenDir(const Target* target); |
159 SourceDir GetCurrentOutputDir(const Scope* scope); | 170 SourceDir GetCurrentOutputDir(const Scope* scope); |
160 SourceDir GetCurrentGenDir(const Scope* scope); | 171 SourceDir GetCurrentGenDir(const Scope* scope); |
161 | 172 |
162 #endif // TOOLS_GN_FILESYSTEM_UTILS_H_ | 173 #endif // TOOLS_GN_FILESYSTEM_UTILS_H_ |
OLD | NEW |