raise an exception when Options::save fails

See #3975 #3976
This commit is contained in:
Alberto Griggio
2017-07-20 17:03:21 +02:00
parent b6cd315515
commit 511f6c2a7b
8 changed files with 73 additions and 42 deletions

View File

@@ -21,6 +21,7 @@
#include <gtkmm.h>
#include "../rtengine/rtengine.h"
#include <exception>
#define STARTUPDIR_CURRENT 0
#define STARTUPDIR_HOME 1
@@ -73,6 +74,16 @@ enum prevdemo_t {PD_Sidecar = 1, PD_Fast = 0};
class Options
{
public:
class Error: public std::exception {
public:
Error(const Glib::ustring &msg): msg_(msg) {}
const char *what() const throw() { return msg_.c_str(); }
const Glib::ustring &get_msg() const throw() { return msg_; }
private:
Glib::ustring msg_;
};
private:
bool defProfRawMissing;
@@ -325,10 +336,10 @@ public:
Options* copyFrom (Options* other);
void filterOutParsedExtensions ();
void setDefaults ();
int readFromFile (Glib::ustring fname);
int saveToFile (Glib::ustring fname);
static bool load (bool lightweight = false);
static void save ();
void readFromFile(Glib::ustring fname);
void saveToFile(Glib::ustring fname);
static void load(bool lightweight = false);
static void save();
// if multiUser=false, send back the global profile path
Glib::ustring getPreferredProfilePath();