diff options
| author | Matthias Melcher <github@matthiasm.com> | 2024-01-22 20:20:52 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-01-22 20:20:52 +0100 |
| commit | baa3c6ddc0cf8136ede5fb08acec54675cdc5582 (patch) | |
| tree | 261d4fd30f6b43d9596de4f8c0ca2112c12c8dc3 /src/Fl_Preferences.cxx | |
| parent | 45422a7d1952eb4094c287373afc7f7a1a23ae4a (diff) | |
Fix User Preferences file search order for Unix (#891)
Diffstat (limited to 'src/Fl_Preferences.cxx')
| -rw-r--r-- | src/Fl_Preferences.cxx | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/Fl_Preferences.cxx b/src/Fl_Preferences.cxx index cc3538a78..d4284af19 100644 --- a/src/Fl_Preferences.cxx +++ b/src/Fl_Preferences.cxx @@ -236,7 +236,7 @@ Fl_Preferences::Root Fl_Preferences::filename( char *buffer, size_t buffer_size, which would silently fail to create a preference file. \param[in] root can be \c USER_L or \c SYSTEM_L for user specific or system - wide preferences, add the CLEAR flag to start with a clean set of + wide preferences, add the \c CLEAR flag to start with a clean set of preferences instead of reading them from a preexisting database \param[in] vendor unique text describing the company or author of this file, must be a valid filepath segment \param[in] application unique text describing the application, must be a valid filepath segment @@ -1292,7 +1292,11 @@ Fl_Preferences::RootNode::~RootNode() { // read a preference file and construct the group tree and all entry leaves int Fl_Preferences::RootNode::read() { - if (!filename_) // RUNTIME preferences, or filename could not be created + if ( (root_type_&Fl_Preferences::ROOT_MASK)==Fl_Preferences::MEMORY ) { + prefs_->node->clearDirtyFlags(); + return 0; + } + if (!filename_ || !filename_[0]) // filename could not be created return -1; if ( (root_type_ & Fl_Preferences::CORE) && !(fileAccess_ & Fl_Preferences::CORE_READ_OK) ) { prefs_->node->clearDirtyFlags(); @@ -1341,7 +1345,11 @@ int Fl_Preferences::RootNode::read() { // write the group tree and all entry leaves int Fl_Preferences::RootNode::write() { - if (!filename_) // RUNTIME preferences, or filename could not be created + if ( (root_type_&Fl_Preferences::ROOT_MASK)==Fl_Preferences::MEMORY ) { + prefs_->node->clearDirtyFlags(); + return 0; + } + if (!filename_ || !filename_[0]) // filename could not be created return -1; if ( (root_type_ & Fl_Preferences::CORE) && !(fileAccess_ & Fl_Preferences::CORE_WRITE_OK) ) return -1; |
