1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-26 04:32:35 +01:00

VFS: Fix mounting non-existant paths (#13488)

This commit is contained in:
Elad Ashkenazi 2023-03-04 18:12:45 +02:00 committed by GitHub
parent 2de4c03faa
commit 8bc92a2cbb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 0 deletions

View File

@ -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 / // Mounting completed; fixup for directories due to resolve_path messing with trailing /
list.back()->path = Emu.GetCallbacks().resolve_path(path); 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('/')) if (is_dir && !list.back()->path.ends_with('/'))
list.back()->path += '/'; list.back()->path += '/';
if (!is_dir && list.back()->path.ends_with('/')) if (!is_dir && list.back()->path.ends_with('/'))

View File

@ -327,6 +327,7 @@ EmuCallbacks main_application::CreateCallbacks()
callbacks.resolve_path = [](std::string_view sv) 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(); return QFileInfo(QString::fromUtf8(sv.data(), static_cast<int>(sv.size()))).canonicalFilePath().toStdString();
}; };