Skip to content

Commit

Permalink
VFS: Fix mounting non-existant paths (#13488)
Browse files Browse the repository at this point in the history
  • Loading branch information
elad335 authored Mar 4, 2023
1 parent 2de4c03 commit 8bc92a2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions rpcs3/Emu/VFS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ bool vfs::mount(std::string_view vpath, std::string_view path, bool is_dir)
{
// Mounting completed; fixup for directories due to resolve_path messing with trailing /
list.back()->path = Emu.GetCallbacks().resolve_path(path);
if (list.back()->path.empty())
list.back()->path = std::string(path); // Fallback when resolving failed
if (is_dir && !list.back()->path.ends_with('/'))
list.back()->path += '/';
if (!is_dir && list.back()->path.ends_with('/'))
Expand Down
1 change: 1 addition & 0 deletions rpcs3/main_application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,7 @@ EmuCallbacks main_application::CreateCallbacks()

callbacks.resolve_path = [](std::string_view sv)
{
// May result in an empty string if path does not exist
return QFileInfo(QString::fromUtf8(sv.data(), static_cast<int>(sv.size()))).canonicalFilePath().toStdString();
};

Expand Down

0 comments on commit 8bc92a2

Please sign in to comment.