From d187340fc4d5781de91c2db3958e7a2fb295d795 Mon Sep 17 00:00:00 2001 From: Alex Cortelyou <1689668+acortelyou@users.noreply.github.com> Date: Thu, 18 Jul 2024 15:04:11 -0700 Subject: [PATCH] Prevent rename from deleting new config (#7104) --- esphome/__main__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/esphome/__main__.py b/esphome/__main__.py index 5ff1a28ec7..b13f96daf7 100644 --- a/esphome/__main__.py +++ b/esphome/__main__.py @@ -695,7 +695,8 @@ def command_rename(args, config): os.remove(new_path) return 1 - os.remove(CORE.config_path) + if CORE.config_path != new_path: + os.remove(CORE.config_path) print(color(Fore.BOLD_GREEN, "SUCCESS")) print()