From 01e8579215f7b15a0fc7de9e817b3ef4bdc504f1 Mon Sep 17 00:00:00 2001 From: palmtree5 <3577255+palmtree5@users.noreply.github.com> Date: Wed, 14 Feb 2018 16:39:29 -0900 Subject: [PATCH] [V3 instance setup] allow removing instances without taking a backup + error handling for missing data path (#1277) --- redbot/setup.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/redbot/setup.py b/redbot/setup.py index 1aa8dd0b4..65b050cec 100644 --- a/redbot/setup.py +++ b/redbot/setup.py @@ -190,12 +190,22 @@ def remove_instance(): ) ) print("Removing the instance...") - shutil.rmtree(str(pth)) + try: + shutil.rmtree(str(pth)) + except FileNotFoundError: + pass # data dir was removed manually save_config(selected, {}, remove=True) print("The instance has been removed") return elif yesno.lower() == "n": - print("Ok then") + pth = Path(instance_data["DATA_PATH"]) + print("Removing the instance...") + try: + shutil.rmtree(str(pth)) + except FileNotFoundError: + pass # data dir was removed manually + save_config(selected, {}, remove=True) + print("The instance has been removed") return else: print("That's not a valid option!")