Mercurial > hg > octave-nkf
diff libgui/src/resource-manager.cc @ 17943:efe3e288a20c
check the creation of settings object for success before starting the gui
* resource-manager.cc (do_set_settings): show error message and exit octave
if settings file does not exist or is not writable
author | Torsten <ttl@justmail.de> |
---|---|
date | Sun, 17 Nov 2013 12:47:58 +0100 |
parents | cd97a7ef7355 |
children | b001d9e9fd17 |
line wrap: on
line diff
--- a/libgui/src/resource-manager.cc +++ b/libgui/src/resource-manager.cc @@ -30,6 +30,7 @@ #include <QDir> #include <QNetworkProxy> #include <QLibraryInfo> +#include <QMessageBox> #include "error.h" #include "file-ops.h" @@ -194,6 +195,20 @@ { delete settings; settings = new QSettings (file, QSettings::IniFormat); + + if (! (settings + && QFile::exists (settings->fileName ()) + && settings->isWritable () + && settings->status () == QSettings::NoError)) + { + QString msg = QString (QT_TR_NOOP ("The settings file\n%1\n" + "does not exist and can not be created.\n" + "Make sure you have read and write permissions to\n%2\n\n" + "Octave GUI must be closed now.")); + QMessageBox::critical (0, QString (QT_TR_NOOP ("Octave Critical Error")), + msg.arg (do_get_settings_file ()).arg (do_get_settings_directory ())); + exit (1); + } } bool