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

Unified Diff: tools/gn/filesystem_utils.cc

Issue 1817533002: Make rebase_path() aware of Windows drive letter capitalization (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 | tools/gn/filesystem_utils_unittest.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 2ceca81677dbc68d0e041271ea9702ec1c3302c0..facf442e88df7d9461fd8204b06777ccc4ac732e 100644
--- a/tools/gn/filesystem_utils.cc
+++ b/tools/gn/filesystem_utils.cc
@@ -529,6 +529,19 @@ std::string MakeRelativePath(const std::string& input,
corrected_dest.append(dest);
return MakeRelativePath(input, corrected_dest);
}
+
+ // Make sure that both absolute paths use the same drive letter case.
+ if (IsPathAbsolute(input) && IsPathAbsolute(dest) && input.size() > 1 &&
+ dest.size() > 1) {
+ int letter_pos = base::IsAsciiAlpha(input[0]) ? 0 : 1;
+ if (input[letter_pos] != dest[letter_pos] &&
+ base::ToUpperASCII(input[letter_pos]) ==
+ base::ToUpperASCII(dest[letter_pos])) {
+ std::string corrected_input = input;
+ corrected_input[letter_pos] = dest[letter_pos];
+ return MakeRelativePath(corrected_input, dest);
+ }
+ }
#endif
std::string ret;
« no previous file with comments | « no previous file | tools/gn/filesystem_utils_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698