From f5d8110ead670e0981b9fd9754cd5afd56d36e12 Mon Sep 17 00:00:00 2001 From: Silent Date: Sat, 5 Oct 2019 15:23:12 +0200 Subject: [PATCH] Create emulator directories after changing dev_*** directories (#6707) * Make pkg_install create path to the game recursively * Create emulator directories after changing dev_*** dir paths --- rpcs3/Crypto/unpkg.cpp | 19 ++++++------------- rpcs3/rpcs3qt/vfs_dialog.cpp | 9 +++++++++ 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/rpcs3/Crypto/unpkg.cpp b/rpcs3/Crypto/unpkg.cpp index 92e34833e3..959784ba0c 100644 --- a/rpcs3/Crypto/unpkg.cpp +++ b/rpcs3/Crypto/unpkg.cpp @@ -197,23 +197,16 @@ bool pkg_install(const std::string& path, atomic_t& sync) archive_seek(packet.size, fs::seek_cur); } - // If false, an existing directory is being overwritten: cannot cancel the operation - bool was_null = true; - // Get full path and create the directory const std::string dir = Emulator::GetHddDir() + "game/" + install_id + '/'; - if (!fs::create_dir(dir)) + // If false, an existing directory is being overwritten: cannot cancel the operation + const bool was_null = !fs::is_dir(dir); + + if (!fs::create_path(dir)) { - if (fs::g_tls_error == fs::error::exist) - { - was_null = false; - } - else - { - LOG_ERROR(LOADER, "PKG: Could not create the installation directory %s", dir); - return false; - } + LOG_ERROR(LOADER, "PKG: Could not create the installation directory %s", dir); + return false; } // Allocate buffer with BUF_SIZE size or more if required diff --git a/rpcs3/rpcs3qt/vfs_dialog.cpp b/rpcs3/rpcs3qt/vfs_dialog.cpp index 6a6a328489..af97bdc88a 100644 --- a/rpcs3/rpcs3qt/vfs_dialog.cpp +++ b/rpcs3/rpcs3qt/vfs_dialog.cpp @@ -4,6 +4,8 @@ #include #include +#include "Emu/System.h" + inline std::string sstr(const QString& _in) { return _in.toStdString(); } vfs_dialog::vfs_dialog(std::shared_ptr guiSettings, std::shared_ptr emuSettings, QWidget* parent) @@ -60,6 +62,13 @@ vfs_dialog::vfs_dialog(std::shared_ptr guiSettings, std::shared_pt static_cast(tabs->widget(i))->SetSettings(); } m_emu_settings->SaveSettings(); + + // Recreate folder structure for new VFS paths + if (Emu.IsStopped()) + { + Emu.Init(); + } + accept(); } else if (button == buttons->button(QDialogButtonBox::Close))