mirror of
https://github.com/tiennm99/serena.git
synced 2026-10-14 16:18:03 +00:00
Migrate config from old location only if no config at new location
This commit is contained in:
1 parent
07ebdf78a3
commit
8910b38c02
1 file changed
+6
-5
@@ -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
|
||||
|
||||
|
||||
Reference in new issue
Block a user