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

Unified Diff: tools/gn/source_file.cc

Issue 630223002: gn: Support build directories outside the source tree. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Patch that compiles and passes unit tests on both Windows and Linux Created 6 years, 1 month 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/source_dir_unittest.cc ('k') | tools/gn/substitution_writer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/source_file.cc
diff --git a/tools/gn/source_file.cc b/tools/gn/source_file.cc
index b3eb560bac5b93d8a8f411c60aab7d99174ba8a7..71d8592c1aac614b26b7c919283f369c83217624 100644
--- a/tools/gn/source_file.cc
+++ b/tools/gn/source_file.cc
@@ -9,21 +9,33 @@
#include "tools/gn/filesystem_utils.h"
#include "tools/gn/source_dir.h"
+namespace {
+
+void AssertValueSourceFileString(const std::string& s) {
+#if defined(OS_WIN)
+ DCHECK(s[0] == '/' ||
+ (s.size() > 2 && s[0] != '/' && s[1] == ':' && IsSlash(s[2])));
+#else
+ DCHECK(s[0] == '/');
+#endif
+ DCHECK(!EndsWithSlash(s));
+}
+
+} // namespace
+
SourceFile::SourceFile() {
}
SourceFile::SourceFile(const base::StringPiece& p)
: value_(p.data(), p.size()) {
DCHECK(!value_.empty());
- DCHECK(value_[0] == '/');
- DCHECK(!EndsWithSlash(value_));
+ AssertValueSourceFileString(value_);
}
SourceFile::SourceFile(SwapIn, std::string* value) {
value_.swap(*value);
DCHECK(!value_.empty());
- DCHECK(value_[0] == '/');
- DCHECK(!EndsWithSlash(value_));
+ AssertValueSourceFileString(value_);
}
SourceFile::~SourceFile() {
« no previous file with comments | « tools/gn/source_dir_unittest.cc ('k') | tools/gn/substitution_writer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698