mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 03:24:00 +02:00
add code to remove old persistFilename setting
This commit is contained in:
parent
13d58003be
commit
9633e40c6e
1 changed files with 14 additions and 3 deletions
|
@ -125,11 +125,13 @@ void DomainServerSettingsManager::setupConfigMap(const QStringList& argumentList
|
|||
_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";
|
||||
static const QString ENTITY_SERVER_SETTINGS_KEY = "entity_server_settings";
|
||||
static const QString ENTITY_FILE_NAME_KEY = "persistFilename";
|
||||
static const QString ENTITY_FILE_PATH_KEYPATH = ENTITY_SERVER_SETTINGS_KEY + ".persistFilePath";
|
||||
|
||||
// this was prior to change of poorly named entitiesFileName to entitiesFilePath
|
||||
QVariant* persistFileNameVariant = valueForKeyPath(_configMap.getMergedConfig(), ENTITY_FILE_NAME_KEYPATH);
|
||||
QVariant* persistFileNameVariant = valueForKeyPath(_configMap.getMergedConfig(),
|
||||
ENTITY_SERVER_SETTINGS_KEY + "." + ENTITY_FILE_NAME_KEY);
|
||||
if (persistFileNameVariant && persistFileNameVariant->canConvert(QMetaType::QString)) {
|
||||
QString persistFileName = persistFileNameVariant->toString();
|
||||
|
||||
|
@ -141,6 +143,15 @@ void DomainServerSettingsManager::setupConfigMap(const QStringList& argumentList
|
|||
// write the migrated value
|
||||
*persistFilePath = persistFileName;
|
||||
|
||||
// remove the old setting
|
||||
QVariant* entityServerVariant = valueForKeyPath(_configMap.getUserConfig(), ENTITY_SERVER_SETTINGS_KEY);
|
||||
if (entityServerVariant && entityServerVariant->canConvert(QMetaType::QVariantMap)) {
|
||||
QVariantMap entityServerMap = entityServerVariant->toMap();
|
||||
entityServerMap.remove(ENTITY_FILE_NAME_KEY);
|
||||
|
||||
*entityServerVariant = entityServerMap;
|
||||
}
|
||||
|
||||
// write the new settings to the json file
|
||||
persistToFile();
|
||||
|
||||
|
|
Loading…
Reference in a new issue