VFS: fix vfs::get

Escape each path element separately.
This commit is contained in:
Nekotekina 2020-03-14 14:25:37 +03:00
parent 6c234b48ce
commit 6a8f5e6b38

View File

@ -261,14 +261,20 @@ std::string vfs::get(std::string_view vpath, std::vector<std::string>* out_dir,
return {};
}
// Escape and merge path fragments
// Merge path fragments
if (out_path)
{
*out_path = "/";
*out_path += fmt::merge(name_list, "/");
}
return std::string{result_base} + vfs::escape(fmt::merge(result, "/"));
// Escape for host FS
std::vector<std::string> escaped;
escaped.reserve(result.size());
for (auto& sv : result)
escaped.emplace_back(vfs::escape(sv));
return std::string{result_base} + fmt::merge(escaped, "/");
}
#if __cpp_char8_t >= 201811