confighelper: don't resolve backup path

If the configuration file is a symbolic link we want the backup
generated in the config folder.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
Eric Callahan 2024-08-03 13:51:31 -04:00
parent b40751ba9d
commit 863d0c1e4b
1 changed files with 2 additions and 2 deletions

View File

@ -531,7 +531,7 @@ class ConfigHelper:
def create_backup(self) -> None: def create_backup(self) -> None:
cfg_path = self.server.get_app_args()["config_file"] cfg_path = self.server.get_app_args()["config_file"]
cfg = pathlib.Path(cfg_path).expanduser().resolve() cfg = pathlib.Path(cfg_path).expanduser()
backup = cfg.parent.joinpath(f".{cfg.name}.bkp") backup = cfg.parent.joinpath(f".{cfg.name}.bkp")
backup_fp: Optional[TextIO] = None backup_fp: Optional[TextIO] = None
try: try:
@ -1116,7 +1116,7 @@ def get_configuration(
return ConfigHelper(server, source, 'server', {}) return ConfigHelper(server, source, 'server', {})
def find_config_backup(cfg_path: str) -> Optional[str]: def find_config_backup(cfg_path: str) -> Optional[str]:
cfg = pathlib.Path(cfg_path).expanduser().resolve() cfg = pathlib.Path(cfg_path).expanduser()
backup = cfg.parent.joinpath(f".{cfg.name}.bkp") backup = cfg.parent.joinpath(f".{cfg.name}.bkp")
if backup.is_file(): if backup.is_file():
return str(backup) return str(backup)