Fix real_path again

This commit is contained in:
Maxime Coste 2018-03-19 20:49:05 +11:00
parent 6d8747b886
commit 6e695e37be

View File

@ -79,7 +79,11 @@ String real_path(StringView filename)
{ {
if (non_existing.empty()) if (non_existing.empty())
return res; return res;
return format("{}/{}", res, non_existing);
StringView dir = res;
if (dir.substr(dir.length()-1_byte, 1_byte) == "/")
dir = dir.substr(0_byte, dir.length()-1_byte);
return format("{}/{}", dir, non_existing);
} }
auto it = find(existing.rbegin() + 1, existing.rend(), '/'); auto it = find(existing.rbegin() + 1, existing.rend(), '/');