fix(KIAUH): more file path handling improvements

Signed-off-by: Dominik Willner <th33xitus@gmail.com>
This commit is contained in:
dw-0
2023-12-25 22:31:18 +01:00
parent d20d82aeac
commit 1b4c76d080
3 changed files with 22 additions and 20 deletions

View File

@@ -205,12 +205,12 @@ def get_highest_index(instance_list: List[Klipper]) -> int:
def create_example_printer_cfg(instance: Klipper) -> None:
Logger.print_status(f"Creating example printer.cfg in '{instance.cfg_dir}'")
if instance.cfg_file is not None:
Logger.print_info(f"printer.cfg in '{instance.cfg_dir}' already exists.")
if instance.cfg_file.is_file():
Logger.print_info(f"'{instance.cfg_file}' already exists.")
return
source = MODULE_PATH.joinpath("res/printer.cfg")
target = instance.cfg_dir.joinpath("printer.cfg")
target = instance.cfg_file
try:
shutil.copy(source, target)
except OSError as e: