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

Unified Diff: tools/gn/filesystem_utils.cc

Issue 334333005: Add directory extraction to GN path handling. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge to new file template function Created 6 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/file_template_unittest.cc ('k') | tools/gn/function_get_path_info.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 4cfefa9dc7ee658448233ae08a5af04473e69c2b..ca4562574df561a23ba4f6ecefdecfba422e8404 100644
--- a/tools/gn/filesystem_utils.cc
+++ b/tools/gn/filesystem_utils.cc
@@ -720,10 +720,12 @@ SourceDir GetOutputDirForSourceDir(const Settings* settings,
toolchain.SwapValue(&ret);
ret.append("obj/");
- // The source dir should be source-absolute, so we trim off the two leading
- // slashes to append to the toolchain object directory.
- DCHECK(source_dir.is_source_absolute());
- ret.append(&source_dir.value()[2], source_dir.value().size() - 2);
+ if (source_dir.is_source_absolute()) {
+ // The source dir is source-absolute, so we trim off the two leading
+ // slashes to append to the toolchain object directory.
+ ret.append(&source_dir.value()[2], source_dir.value().size() - 2);
+ }
+ // (Put system-absolute stuff in the root obj directory.)
return SourceDir(SourceDir::SWAP_IN, &ret);
}
@@ -735,10 +737,13 @@ SourceDir GetGenDirForSourceDir(const Settings* settings,
std::string ret;
toolchain.SwapValue(&ret);
- // The source dir should be source-absolute, so we trim off the two leading
- // slashes to append to the toolchain object directory.
- DCHECK(source_dir.is_source_absolute());
- ret.append(&source_dir.value()[2], source_dir.value().size() - 2);
+ if (source_dir.is_source_absolute()) {
+ // The source dir should be source-absolute, so we trim off the two leading
+ // slashes to append to the toolchain object directory.
+ DCHECK(source_dir.is_source_absolute());
+ ret.append(&source_dir.value()[2], source_dir.value().size() - 2);
+ }
+ // (Put system-absolute stuff in the root gen directory.)
return SourceDir(SourceDir::SWAP_IN, &ret);
}
« no previous file with comments | « tools/gn/file_template_unittest.cc ('k') | tools/gn/function_get_path_info.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698