From aba015b5873a7edbd0e3d4e103459113c9f36547 Mon Sep 17 00:00:00 2001 From: Pablo P Varela Date: Sat, 7 Dec 2024 17:21:17 +0100 Subject: [PATCH] don't remove if it does not exist Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --- dot.lua | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/dot.lua b/dot.lua index ca2dd47..ff6caee 100755 --- a/dot.lua +++ b/dot.lua @@ -880,7 +880,15 @@ local function remove_last_profile() if not is_dir(".git") then file_path = ".dot" end - os.remove(file_path) + if is_file(file_path) then + local success, err = os.remove(file_path) + if not success then + print_message("error", "Failed to remove profile: " .. err) + return false + end + return true + end + return true end -- Main function