From 9db29f0a0161fa466393c182ccebb00139b38cc5 Mon Sep 17 00:00:00 2001 From: Lorow Date: Sun, 13 Apr 2025 20:25:54 +0200 Subject: [PATCH] Fix dry-run truncating the main config file --- tools/switchBoardType.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/switchBoardType.py b/tools/switchBoardType.py index b4e5584..562fad4 100644 --- a/tools/switchBoardType.py +++ b/tools/switchBoardType.py @@ -64,7 +64,7 @@ print(f"{OKGREEN}Switching configuration to board:{ENDC} {OKBLUE}{args.board}{EN print(f"{OKGREEN}Using defaults from :{ENDC} {get_base_config_path()}", ) print(f"{OKGREEN}Using board config from :{ENDC} {get_board_config_path()}") -main_config = open(get_main_config_path(), "w+") +main_config = open(get_main_config_path(), "a+") base_config = open(get_base_config_path(), "r") board_config = open(get_board_config_path(), "r") @@ -87,7 +87,8 @@ if not args.dry_run: # and then add the board config on top of that, overriding where necessary. # This way we can have known working defaults safe from accidental modifications by espidf # with know working per-board config - # and a still modifiable sdkconfig for espidf + # and a still modifiable sdkconfig for espidf + main_config.truncate(0) for key in parsed_board_config: parsed_base_config[key] = parsed_board_config[key]