FR: PropertiesFile::Options::DefaultOptions();

This class is nice but every time I use it, I always set it up like this:

PropertiesFile::Options options;
options.applicationName = ProjectInfo::projectName;
options.filenameSuffix = ".settings";
options.osxLibrarySubFolder = "Application Support";
options.folderName = ProjectInfo::companyName;
options.storageFormat = PropertiesFile::storeAsXML;

It might just be me, but this seems like it could be a pretty useful default setup, maybe implemented like this:

//static
PropertiesFile::Options PropertiesFile::Options::DefaultOptions(const String& suffix)
{
    //you must provide a project name in Projucer
    jassert( !String(ProjectInfo::projectName).isEmpty() ); 
    //you must provide a company name in ProJucer
    jassert( !String(ProjectInfo::companyName).isEmpty() ); 

    PropertiesFile::Options options;
    options.applicationName = ProjectInfo::projectName;
    options.filenameSuffix = suffix.isEmpty() ? ".settings" : suffix;
#if JUCE_OSX
    options.osxLibrarySubFolder = "Application Support";
#endif
    options.folderName = ProjectInfo::companyName;
    options.storageFormat = PropertiesFile::storeAsXML;

    return options;
}

any comments?

1 Like