[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:
lizzie
2026-05-13 19:14:59 +02:00
committed by crueter
parent 1f558ce9b3
commit ee188168c1
3 changed files with 13 additions and 14 deletions
+4 -6
View File
@@ -181,15 +181,13 @@ void InstallFirmware(const QString& location, bool recursive) {
QString UnzipFirmwareToTmp(const QString& location) {
namespace fs = std::filesystem;
fs::path tmp{fs::temp_directory_path()};
if (!fs::create_directories(tmp / "eden" / "firmware")) {
fs::path tmp{fs::temp_directory_path() / "eden" / "firmware"};
std::error_code ec;
fs::remove_all(tmp, ec);
if (!fs::create_directories(tmp, ec)) {
return QString();
}
tmp /= "eden";
tmp /= "firmware";
QString qCacheDir = QString::fromStdString(tmp.string());
QFile zip(location);