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

Unified Diff: tools/gn/command_refs.cc

Issue 2160383002: Make `gn refs` handle files in data directories properly. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@gn_refs_scripts
Patch Set: use base::StartsWith Created 4 years, 5 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/command_refs.cc
diff --git a/tools/gn/command_refs.cc b/tools/gn/command_refs.cc
index fcd824a6842ea72bef034ec308055d02d8a17664..64969b9e80dcbddfe9fef4e2da7f929fec2bc5cb 100644
--- a/tools/gn/command_refs.cc
+++ b/tools/gn/command_refs.cc
@@ -10,6 +10,7 @@
#include "base/command_line.h"
#include "base/files/file_util.h"
#include "base/strings/string_split.h"
+#include "base/strings/string_util.h"
#include "tools/gn/commands.h"
#include "tools/gn/deps_iterator.h"
#include "tools/gn/filesystem_utils.h"
@@ -143,6 +144,9 @@ bool TargetContainsFile(const Target* target, const SourceFile& file) {
for (const auto& cur_file : target->data()) {
if (cur_file == file.value())
return true;
+ if (cur_file.back() == '/' &&
+ base::StartsWith(file.value(), cur_file, base::CompareCase::SENSITIVE))
+ return true;
}
if (target->action_values().script().value() == file.value())
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698