46void ApplicationProperties::openFiles()
55 if (userProps ==
nullptr)
57 o.commonToAllUsers =
false;
61 if (commonProps ==
nullptr)
63 o.commonToAllUsers =
true;
64 commonProps.reset (
new PropertiesFile (o));
67 userProps->setFallbackPropertySet (commonProps.get());
73 if (userProps ==
nullptr)
76 return userProps.get();
81 if (commonProps ==
nullptr)
86 if (commonSettingsAreReadOnly == 0)
87 commonSettingsAreReadOnly = commonProps->save() ? -1 : 1;
89 if (commonSettingsAreReadOnly > 0)
90 return userProps.get();
93 return commonProps.get();
98 return (userProps ==
nullptr || userProps->saveIfNeeded())
99 && (commonProps ==
nullptr || commonProps->saveIfNeeded());
void closeFiles()
Flushes and closes both files if they are open.
PropertiesFile * getUserSettings()
Returns the user settings file.
ApplicationProperties()
Creates an ApplicationProperties object.
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.
Holds a resizable array of primitive or copy-by-value objects.
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.
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...