Revert "Revert "added error message if settings initalizion failed""

This reverts commit f3ff40385d.
This commit is contained in:
fourtf
2019-10-05 16:40:04 +02:00
parent 37ceeb3945
commit b64e2e9b70
4 changed files with 40 additions and 10 deletions
+30 -3
View File
@@ -5,6 +5,7 @@
#include "BrowserExtension.hpp"
#include "RunGui.hpp"
#include "common/Args.hpp"
#include "common/Modes.hpp"
#include "singletons/Paths.hpp"
#include "singletons/Settings.hpp"
#include "util/IncognitoBrowser.hpp"
@@ -28,9 +29,35 @@ int main(int argc, char **argv)
else
{
initArgs(args);
Paths paths;
Settings settings(paths.settingsDirectory);
Paths *paths{};
runGui(a, paths, settings);
try
{
paths = new Paths;
}
catch (std::runtime_error &error)
{
QMessageBox box;
if (Modes::getInstance().isPortable)
{
box.setText(
error.what() +
QStringLiteral(
"\n\nInfo: Portable mode requires the application to "
"be in a writeable location. If you don't want "
"portable mode reinstall the application. "
"https://chatterino.com."));
}
else
{
box.setText(error.what());
}
box.exec();
return 1;
}
Settings settings(paths->settingsDirectory);
runGui(a, *paths, settings);
}
}