Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(36)

Unified Diff: tools/gn/filesystem_utils.cc

Issue 1126193005: Check for inputs not generated by deps (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@data
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/gn/filesystem_utils.h ('k') | tools/gn/function_write_file.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.",
« no previous file with comments | « tools/gn/filesystem_utils.h ('k') | tools/gn/function_write_file.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698