Io: Correct CreateFullPath() on Linux.

Fixes #14519.
This commit is contained in:
Unknown W. Brackets 2021-06-09 23:09:04 -07:00
parent 84036fa765
commit 39f479025e
2 changed files with 3 additions and 0 deletions

View file

@ -317,6 +317,8 @@ std::string Path::PathTo(const Path &other) {
return std::string();
}
diff = a.PathTo(b);
} else if (path_ == "/") {
diff = other.path_.substr(1);
} else {
diff = other.path_.substr(path_.size() + 1);
}

View file

@ -607,6 +607,7 @@ static bool TestPath() {
EXPECT_EQ_STR(Path("C:\\Yo\\Lo").GetFilename(), std::string("Lo"));
EXPECT_EQ_STR(Path("/a/b").PathTo(Path("/a/b/c/d/e")), std::string("c/d/e"));
EXPECT_EQ_STR(Path("/").PathTo(Path("/home/foo/bar")), std::string("home/foo/bar"));
return true;
}