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,24 +197,17 @@ bool pkg_install(const std::string& path, atomic_t<double>& 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 (fs::g_tls_error == fs::error::exist)
{
was_null = false;
}
else
// 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))
{
LOG_ERROR(LOADER, "PKG: Could not create the installation directory %s", dir);
return false;
}
}
// Allocate buffer with BUF_SIZE size or more if required
const std::unique_ptr<u128[]> buf(new u128[std::max<u64>(BUF_SIZE, sizeof(PKGEntry) * header.file_count) / sizeof(u128)]);

View File

@ -4,6 +4,8 @@
#include <QPushButton>
#include <QMessageBox>
#include "Emu/System.h"
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)
@ -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();
}
m_emu_settings->SaveSettings();
// Recreate folder structure for new VFS paths
if (Emu.IsStopped())
{
Emu.Init();
}
accept();
}
else if (button == buttons->button(QDialogButtonBox::Close))