| 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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 // | 93 // |
| 94 // The origin will be blamed in the error. | 94 // The origin will be blamed in the error. |
| 95 // | 95 // |
| 96 // If the file isn't in the dir, returns false and sets the error. Otherwise | 96 // If the file isn't in the dir, returns false and sets the error. Otherwise |
| 97 // returns true and leaves the error untouched. | 97 // returns true and leaves the error untouched. |
| 98 bool EnsureStringIsInOutputDir(const SourceDir& output_dir, | 98 bool EnsureStringIsInOutputDir(const SourceDir& output_dir, |
| 99 const std::string& str, | 99 const std::string& str, |
| 100 const ParseNode* origin, | 100 const ParseNode* origin, |
| 101 Err* err); | 101 Err* err); |
| 102 | 102 |
| 103 // If the file isn't in the dir, returns the empty string and sets the error. |
| 104 // Otherwise returns the short output name and leaves the error untouched. |
| 105 base::FilePath::StringType ComputeStringInOutputDir(const SourceDir& output_dir, |
| 106 const SourceFile& file, |
| 107 Err* err); |
| 108 |
| 109 |
| 103 // ---------------------------------------------------------------------------- | 110 // ---------------------------------------------------------------------------- |
| 104 | 111 |
| 105 // Returns true if the input string is absolute. Double-slashes at the | 112 // Returns true if the input string is absolute. Double-slashes at the |
| 106 // beginning are treated as source-relative paths. On Windows, this handles | 113 // beginning are treated as source-relative paths. On Windows, this handles |
| 107 // paths of both the native format: "C:/foo" and ours "/C:/foo" | 114 // paths of both the native format: "C:/foo" and ours "/C:/foo" |
| 108 bool IsPathAbsolute(const base::StringPiece& path); | 115 bool IsPathAbsolute(const base::StringPiece& path); |
| 109 | 116 |
| 110 // Given an absolute path, checks to see if is it is inside the source root. | 117 // Given an absolute path, checks to see if is it is inside the source root. |
| 111 // If it is, fills a source-absolute path into the given output and returns | 118 // If it is, fills a source-absolute path into the given output and returns |
| 112 // true. If it isn't, clears the dest and returns false. | 119 // true. If it isn't, clears the dest and returns false. |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 | 195 |
| 189 SourceDir GetTargetOutputDir(const Target* target); | 196 SourceDir GetTargetOutputDir(const Target* target); |
| 190 OutputFile GetTargetOutputDirAsOutputFile(const Target* target); | 197 OutputFile GetTargetOutputDirAsOutputFile(const Target* target); |
| 191 SourceDir GetTargetGenDir(const Target* target); | 198 SourceDir GetTargetGenDir(const Target* target); |
| 192 OutputFile GetTargetGenDirAsOutputFile(const Target* target); | 199 OutputFile GetTargetGenDirAsOutputFile(const Target* target); |
| 193 | 200 |
| 194 SourceDir GetCurrentOutputDir(const Scope* scope); | 201 SourceDir GetCurrentOutputDir(const Scope* scope); |
| 195 SourceDir GetCurrentGenDir(const Scope* scope); | 202 SourceDir GetCurrentGenDir(const Scope* scope); |
| 196 | 203 |
| 197 #endif // TOOLS_GN_FILESYSTEM_UTILS_H_ | 204 #endif // TOOLS_GN_FILESYSTEM_UTILS_H_ |
| OLD | NEW |