summaryrefslogtreecommitdiff
path: root/gn
diff options
context:
space:
mode:
authorAllan Jensen <allan.jensen@qt.io>2019-04-03 11:17:48 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2021-11-11 13:13:30 +0100
commitc81fb53355d3ab4882374450d5331065a9c6bad3 (patch)
treee7e75e0300a96374a6374214dbd798ae8896baaf /gn
parent9aedef545e3b698644ca68a60ca24882edf71b5d (diff)
downloadqtwebengine-chromium-c81fb53355d3ab4882374450d5331065a9c6bad3.tar.gz
Fix clang_cl builds of gn
Change-Id: Ibbd0d7a88ce84fe5eb8902d301f5fc1252fee432 Reviewed-by: Michal Klocek <michal.klocek@qt.io>
Diffstat (limited to 'gn')
-rw-r--r--gn/src/gn/filesystem_utils.cc12
1 files changed, 12 insertions, 0 deletions
diff --git a/gn/src/gn/filesystem_utils.cc b/gn/src/gn/filesystem_utils.cc
index ae6d4d97ee9..3aec9ea4eb8 100644
--- a/gn/src/gn/filesystem_utils.cc
+++ b/gn/src/gn/filesystem_utils.cc
@@ -633,6 +633,11 @@ void NormalizePath(std::string* path, const std::string_view& source_root) {
void ConvertPathToSystem(std::string* path) {
#if defined(OS_WIN)
+ if (path->size() > 2) {
+ if (IsSlash((*path)[0]) && (*path)[2] == ':') {
+ *path = path->substr(1);
+ }
+ }
for (size_t i = 0; i < path->size(); i++) {
if ((*path)[i] == '/')
(*path)[i] = '\\';
@@ -668,6 +673,13 @@ std::string MakeRelativePath(const std::string& input,
corrected_input[letter_pos] = dest[letter_pos];
return MakeRelativePath(corrected_input, dest);
}
+ // Give up if the drive paths are different so we don't end up
+ // returning a meaningless result.
+ if (input[letter_pos] != dest[letter_pos]) {
+ std::string ret = input;
+ ConvertPathToSystem(&ret);
+ return ret;
+ }
}
#endif