mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2026-08-20 14:57:55 +00:00
[common] do not crash when don't have permissions to /tmp/eden directory due to unforessen circumstances (FreeBSD) (#3912)
instead of throwing, use std::error_code and such due to reasons unberknownst to me, the UID of the /tmp/eden directory was set for another user, this inevitably caused a crash due to wrong permissions (which is a very user unfriendly thing to do generally) Signed-off-by: lizzie <lizzie@eden-emu.dev> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3912 Reviewed-by: crueter <crueter@eden-emu.dev>
This commit is contained in:
@@ -83,8 +83,9 @@ QStringList GetModFolders(const QString& root, const QString& fallbackName) {
|
||||
// now make a temp directory...
|
||||
const auto mod_dir = fs::temp_directory_path() / "eden" / "mod" / name.toStdString();
|
||||
const auto tmp = mod_dir / to_make;
|
||||
fs::remove_all(mod_dir);
|
||||
if (!fs::create_directories(tmp)) {
|
||||
std::error_code ec;
|
||||
fs::remove_all(mod_dir, ec);
|
||||
if (!fs::create_directories(tmp, ec)) {
|
||||
LOG_ERROR(Frontend, "Failed to create temporary directory {}", tmp.string());
|
||||
return {};
|
||||
}
|
||||
@@ -116,9 +117,9 @@ QStringList GetModFolders(const QString& root, const QString& fallbackName) {
|
||||
const QString ExtractMod(const QString& path) {
|
||||
namespace fs = std::filesystem;
|
||||
fs::path tmp{fs::temp_directory_path() / "eden" / "unzip_mod"};
|
||||
|
||||
fs::remove_all(tmp);
|
||||
if (!fs::create_directories(tmp)) {
|
||||
std::error_code ec;
|
||||
fs::remove_all(tmp, ec);
|
||||
if (!fs::create_directories(tmp, ec)) {
|
||||
QtCommon::Frontend::Critical(tr("Mod Extract Failed"),
|
||||
tr("Failed to create temporary directory %1")
|
||||
.arg(QString::fromStdString(tmp.string())));
|
||||
|
||||
Reference in New Issue
Block a user