diff --git a/bin/config.py b/bin/config.py index 5ba67e0..5f2832d 100644 --- a/bin/config.py +++ b/bin/config.py @@ -7,7 +7,6 @@ from pathlib import Path _MYTOOLKIT_HOME = Path(os.environ.get("MYTOOLKIT_HOME", Path.home() / ".mytoolkit")) CONFIG_PATH = _MYTOOLKIT_HOME / "env.json" _LEGACY_PATH = Path(__file__).parent / "config.json" -_LEGACY_CONFIG_DIR = Path.home() / ".config" / "mytoolkit" / "env.json" class Config: @@ -19,14 +18,10 @@ class Config: self._data = self._load() def _migrate_legacy(self) -> None: - """One-shot move of legacy configs into the user config dir.""" - if self._config_path.exists(): - return - self._config_path.parent.mkdir(parents=True, exist_ok=True) - if _LEGACY_PATH.exists(): + """One-shot move of legacy bin/config.json into the user config dir.""" + if _LEGACY_PATH.exists() and not self._config_path.exists(): + self._config_path.parent.mkdir(parents=True, exist_ok=True) _LEGACY_PATH.rename(self._config_path) - elif _LEGACY_CONFIG_DIR.exists(): - _LEGACY_CONFIG_DIR.rename(self._config_path) def _load(self) -> dict: if self._config_path.exists():