Merge pull request #15040 from unknownbrackets/path-slashes

Path: Avoid adding a double slash from root
This commit is contained in:
Henrik Rydgård 2021-10-21 00:56:16 +02:00 committed by GitHub
commit 4bd4cde4a2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -87,7 +87,7 @@ Path Path::operator /(const std::string &subdir) const {
return Path(path_);
}
std::string fullPath = path_;
if (subdir.front() != '/') {
if (subdir.front() != '/' && (fullPath.empty() || fullPath.back() != '/')) {
fullPath += "/";
}
fullPath += subdir;