41void ApplicationProperties::openFiles()
50 if (userProps ==
nullptr)
52 o.commonToAllUsers =
false;
56 if (commonProps ==
nullptr)
58 o.commonToAllUsers =
true;
59 commonProps.reset (
new PropertiesFile (
o));
62 userProps->setFallbackPropertySet (commonProps.get());
68 if (userProps ==
nullptr)
71 return userProps.get();
76 if (commonProps ==
nullptr)
81 if (commonSettingsAreReadOnly == 0)
82 commonSettingsAreReadOnly = commonProps->save() ? -1 : 1;
84 if (commonSettingsAreReadOnly > 0)
85 return userProps.get();
88 return commonProps.get();
93 return (userProps ==
nullptr || userProps->saveIfNeeded())
94 && (commonProps ==
nullptr || commonProps->saveIfNeeded());
void closeFiles()
Flushes and closes both files if they are open.
PropertiesFile * getUserSettings()
Returns the user settings file.
PropertiesFile * getCommonSettings(bool returnUserPropsIfReadOnly)
Returns the common settings file.
bool saveIfNeeded()
Saves both files if they need to be saved.
~ApplicationProperties()
Destructor.
void setStorageParameters(const PropertiesFile::Options &options)
Gives the object the information it needs to create the appropriate properties files.
Wrapper on a file that stores a list of key/value data pairs.
bool isNotEmpty() const noexcept
Returns true if the string contains at least one character.
Type unalignedPointerCast(void *ptr) noexcept
Casts a pointer to another type via void*, which suppresses the cast-align warning which sometimes ar...
Structure describing properties file options.
String applicationName
The name of your application - this is used to help generate the path and filename at which the prope...