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
This commit is contained in:
Silent 2019-10-05 15:23:12 +02:00 committed by Ivan
parent 9e929a25d4
commit f5d8110ead
2 changed files with 15 additions and 13 deletions

View File

@ -197,23 +197,16 @@ bool pkg_install(const std::string& path, atomic_t<double>& sync)
archive_seek(packet.size, fs::seek_cur); 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 // Get full path and create the directory
const std::string dir = Emulator::GetHddDir() + "game/" + install_id + '/'; 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) LOG_ERROR(LOADER, "PKG: Could not create the installation directory %s", dir);
{ return false;
was_null = false;
}
else
{
LOG_ERROR(LOADER, "PKG: Could not create the installation directory %s", dir);
return false;
}
} }
// Allocate buffer with BUF_SIZE size or more if required // Allocate buffer with BUF_SIZE size or more if required

View File

@ -4,6 +4,8 @@
#include <QPushButton> #include <QPushButton>
#include <QMessageBox> #include <QMessageBox>
#include "Emu/System.h"
inline std::string sstr(const QString& _in) { return _in.toStdString(); } inline std::string sstr(const QString& _in) { return _in.toStdString(); }
vfs_dialog::vfs_dialog(std::shared_ptr<gui_settings> guiSettings, std::shared_ptr<emu_settings> emuSettings, QWidget* parent) vfs_dialog::vfs_dialog(std::shared_ptr<gui_settings> guiSettings, std::shared_ptr<emu_settings> emuSettings, QWidget* parent)
@ -60,6 +62,13 @@ vfs_dialog::vfs_dialog(std::shared_ptr<gui_settings> guiSettings, std::shared_pt
static_cast<vfs_dialog_tab*>(tabs->widget(i))->SetSettings(); static_cast<vfs_dialog_tab*>(tabs->widget(i))->SetSettings();
} }
m_emu_settings->SaveSettings(); m_emu_settings->SaveSettings();
// Recreate folder structure for new VFS paths
if (Emu.IsStopped())
{
Emu.Init();
}
accept(); accept();
} }
else if (button == buttons->button(QDialogButtonBox::Close)) else if (button == buttons->button(QDialogButtonBox::Close))