| Index: tools/gn/filesystem_utils.cc
|
| diff --git a/tools/gn/filesystem_utils.cc b/tools/gn/filesystem_utils.cc
|
| index 7495b05c903312cfd0da7fd0e9cdac15d0a9bf82..325cfc68d55e3601e5d953eef99792d7f8656da7 100644
|
| --- a/tools/gn/filesystem_utils.cc
|
| +++ b/tools/gn/filesystem_utils.cc
|
| @@ -310,14 +310,18 @@ base::StringPiece FindLastDirComponent(const SourceDir& dir) {
|
| return base::StringPiece(&dir_string[0], end);
|
| }
|
|
|
| -bool EnsureStringIsInOutputDir(const SourceDir& dir,
|
| +bool IsStringInOutputDir(const SourceDir& output_dir, const std::string& str) {
|
| + // This check will be wrong for all proper prefixes "e.g. "/output" will
|
| + // match "/out" but we don't really care since this is just a sanity check.
|
| + const std::string& dir_str = output_dir.value();
|
| + return str.compare(0, dir_str.length(), dir_str) == 0;
|
| +}
|
| +
|
| +bool EnsureStringIsInOutputDir(const SourceDir& output_dir,
|
| const std::string& str,
|
| const ParseNode* origin,
|
| Err* err) {
|
| - // This check will be wrong for all proper prefixes "e.g. "/output" will
|
| - // match "/out" but we don't really care since this is just a sanity check.
|
| - const std::string& dir_str = dir.value();
|
| - if (str.compare(0, dir_str.length(), dir_str) == 0)
|
| + if (IsStringInOutputDir(output_dir, str))
|
| return true; // Output directory is hardcoded.
|
|
|
| *err = Err(origin, "File is not inside output directory.",
|
|
|