1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-23 03:02:53 +01:00

VFS.cpp: fixup for mounting files

This commit is contained in:
Nekotekina 2022-10-31 12:34:53 +03:00 committed by Ivan
parent ae809ad320
commit a1b4ffcf52
2 changed files with 7 additions and 8 deletions

View File

@ -33,7 +33,7 @@ struct vfs_manager
vfs_directory root{};
};
bool vfs::mount(std::string_view vpath, std::string_view path, bool create_dir)
bool vfs::mount(std::string_view vpath, std::string_view path, bool create_dir, bool is_dir)
{
if (vpath.empty())
{
@ -73,9 +73,12 @@ bool vfs::mount(std::string_view vpath, std::string_view path, bool create_dir)
if (pos == umax)
{
// Mounting completed
// Mounting completed; fixup for directories due to resolve_path messing with trailing /
list.back()->path = Emu.GetCallbacks().resolve_path(path);
list.back()->path += '/';
if (is_dir && !list.back()->path.ends_with('/'))
list.back()->path += '/';
if (!is_dir && list.back()->path.ends_with('/'))
vfs_log.error("File mounted with trailing /.");
vfs_log.notice("Mounted path \"%s\" to \"%s\"", vpath_backup, list.back()->path);
return true;
}
@ -360,11 +363,7 @@ std::string vfs::get(std::string_view vpath, std::vector<std::string>* out_dir,
return std::string{result_base} + fmt::merge(escaped, "/");
}
#if __cpp_char8_t >= 201811
using char2 = char8_t;
#else
using char2 = char;
#endif
std::string vfs::retrieve(std::string_view path, const vfs_directory* node, std::vector<std::string_view>* mount_path)
{

View File

@ -10,7 +10,7 @@ struct vfs_directory;
namespace vfs
{
// Mount VFS device
bool mount(std::string_view vpath, std::string_view path, bool create_dir = false);
bool mount(std::string_view vpath, std::string_view path, bool create_dir = false, bool is_dir = true);
// Unmount VFS device
bool unmount(std::string_view vpath);