diff --git a/rpcs3/Emu/VFS.cpp b/rpcs3/Emu/VFS.cpp index f13e8f3703..5b47d36d3f 100644 --- a/rpcs3/Emu/VFS.cpp +++ b/rpcs3/Emu/VFS.cpp @@ -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* 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* mount_path) { diff --git a/rpcs3/Emu/VFS.h b/rpcs3/Emu/VFS.h index 4c53c25640..b943053b00 100644 --- a/rpcs3/Emu/VFS.h +++ b/rpcs3/Emu/VFS.h @@ -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);