migrate persistFilename to persistFilePath in DS settings

This commit is contained in:
Stephen Birarda 2016-02-02 15:02:12 -08:00
parent 4d91b8b7d6
commit 13d58003be
2 changed files with 25 additions and 1 deletions

View file

@ -1,5 +1,5 @@
{
"version": 1.0,
"version": 1.1,
"settings": [
{
"name": "metaverse",

View file

@ -124,6 +124,30 @@ void DomainServerSettingsManager::setupConfigMap(const QStringList& argumentList
// reload the master and user config so that the merged config is right
_configMap.loadMasterAndUserConfig(argumentList);
}
} else if (oldVersion < 1.1) {
static const QString ENTITY_FILE_NAME_KEYPATH = "entity_server_settings.persistFilename";
static const QString ENTITY_FILE_PATH_KEYPATH = "entity_server_settings.persistFilePath";
// this was prior to change of poorly named entitiesFileName to entitiesFilePath
QVariant* persistFileNameVariant = valueForKeyPath(_configMap.getMergedConfig(), ENTITY_FILE_NAME_KEYPATH);
if (persistFileNameVariant && persistFileNameVariant->canConvert(QMetaType::QString)) {
QString persistFileName = persistFileNameVariant->toString();
qDebug() << "Migrating persistFilename to persistFilePath for entity-server settings";
// grab the persistFilePath option, create it if it doesn't exist
QVariant* persistFilePath = valueForKeyPath(_configMap.getUserConfig(), ENTITY_FILE_PATH_KEYPATH, true);
// write the migrated value
*persistFilePath = persistFileName;
// write the new settings to the json file
persistToFile();
// reload the master and user config so that the merged config is right
_configMap.loadMasterAndUserConfig(argumentList);
}
}
}