VFS: fix missing path deliminators

This commit is contained in:
Megamouse 2022-01-12 20:29:33 +01:00 committed by Ivan
parent ef0bee9228
commit 84753db574
1 changed files with 2 additions and 3 deletions

View File

@ -49,7 +49,6 @@ bool vfs::mount(std::string_view vpath, std::string_view path)
return false;
}
const bool delim_suffixed = path.ends_with(fs::delim);
std::string final_path = fs::resolve_path(path);
if (final_path.empty())
@ -58,7 +57,7 @@ bool vfs::mount(std::string_view vpath, std::string_view path)
return false;
}
if (!final_path.ends_with(fs::delim) && delim_suffixed)
if (!final_path.ends_with(fs::delim[0]) && !final_path.ends_with(fs::delim[1]) && (path.ends_with(fs::delim[0]) || path.ends_with(fs::delim[1])))
{
final_path += '/';
}
@ -83,7 +82,7 @@ bool vfs::mount(std::string_view vpath, std::string_view path)
{
// Mounting completed
list.back()->path = std::move(final_path);
vfs_log.notice("Mounted path \"%s\" to \"%s\"", vpath_backup, final_path);
vfs_log.notice("Mounted path \"%s\" to \"%s\"", vpath_backup, list.back()->path);
return true;
}