Migrate config from old location only if no config at new location

This commit is contained in:
Dominik Jain authored and Dominik Jain committed 2025-07-03 12:14:39 +02:00
1 parent 07ebdf78a3
commit 8910b38c02
1 file changed
+6 -5
+6 -5
View File
@@ -247,11 +247,12 @@ class SerenaConfig:
else:
config_path = str(Path.home() / SERENA_MANAGED_DIR_NAME / cls.CONFIG_FILE)
# migrate configuration in old location
old_config_path = os.path.join(REPO_ROOT, cls.CONFIG_FILE)
if os.path.exists(old_config_path):
log.info(f"Moving Serena configuration file from {old_config_path} to {config_path}")
shutil.move(old_config_path, config_path)
# if the config file does not exist, check if we can migrate it from the old location
if not os.path.exists(config_path):
old_config_path = os.path.join(REPO_ROOT, cls.CONFIG_FILE)
if os.path.exists(old_config_path):
log.info(f"Moving Serena configuration file from {old_config_path} to {config_path}")
shutil.move(old_config_path, config_path)
return config_path