summaryrefslogtreecommitdiff
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-10-04 10:20:52 +0200
commit6c9d68192626bd051e9d43a86ec050c45072eabe (patch)
tree1605ddab130b9f875ecd4d9345b72e911936e570
parenta80022aebc8a73f3789ff7ef22d351ff6b512b33 (diff)
downloadqtwebengine-chromium-6c9d68192626bd051e9d43a86ec050c45072eabe.tar.gz
Fix clang_cl builds of gn
Change-Id: Ibbd0d7a88ce84fe5eb8902d301f5fc1252fee432 Reviewed-by: Michal Klocek <michal.klocek@qt.io>
-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