1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-12-13 08:13:06 +00:00

Merge branch 'error_codes' into 'master'

Use error messages instead of unhandled exceptions

See merge request OpenMW/openmw!3723
This commit is contained in:
Alexei Kotov 2024-01-04 20:35:37 +00:00
commit 19a7d50a3f

View file

@ -118,13 +118,14 @@ Launcher::FirstRunDialogResult Launcher::MainDialog::showFirstRunDialog()
const auto& userConfigDir = mCfgMgr.getUserConfigPath(); const auto& userConfigDir = mCfgMgr.getUserConfigPath();
if (!exists(userConfigDir)) if (!exists(userConfigDir))
{ {
if (!create_directories(userConfigDir)) std::error_code ec;
if (!create_directories(userConfigDir, ec))
{ {
cfgError(tr("Error opening OpenMW configuration file"), cfgError(tr("Error creating OpenMW configuration directory: code %0").arg(ec.value()),
tr("<br><b>Could not create directory %0</b><br><br>" tr("<br><b>Could not create directory %0</b><br><br>"
"Please make sure you have the right permissions " "%1<br>")
"and try again.<br>") .arg(Files::pathToQString(userConfigDir))
.arg(Files::pathToQString(canonical(userConfigDir)))); .arg(QString(ec.message().c_str())));
return FirstRunDialogResultFailure; return FirstRunDialogResultFailure;
} }
} }
@ -457,13 +458,14 @@ bool Launcher::MainDialog::writeSettings()
if (!exists(userPath)) if (!exists(userPath))
{ {
if (!create_directories(userPath)) std::error_code ec;
if (!create_directories(userPath, ec))
{ {
cfgError(tr("Error creating OpenMW configuration directory"), cfgError(tr("Error creating OpenMW configuration directory: code %0").arg(ec.value()),
tr("<br><b>Could not create %0</b><br><br>" tr("<br><b>Could not create directory %0</b><br><br>"
"Please make sure you have the right permissions " "%1<br>")
"and try again.<br>") .arg(Files::pathToQString(userPath))
.arg(Files::pathToQString(userPath))); .arg(QString(ec.message().c_str())));
return false; return false;
} }
} }