From 6c91ec88c7cc5e14a94d640d57d0f27d75262890 Mon Sep 17 00:00:00 2001 From: Nathan Woodburn Date: Fri, 22 Nov 2024 09:47:37 +1100 Subject: [PATCH] fix: Create user_data dir if it doesn't exist --- plugins/automations.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/plugins/automations.py b/plugins/automations.py index a85e9b5..5fb17ec 100644 --- a/plugins/automations.py +++ b/plugins/automations.py @@ -10,6 +10,8 @@ ip = os.getenv("hsd_ip") if ip is None: ip = "localhost" +if not os.path.exists("user_data"): + os.mkdir("user_data") # Plugin Data info = { @@ -96,6 +98,8 @@ def automation(params, authentication): def disable(params, authentication): # Create walletname file in user_data wallet = authentication.split(":")[0] + if not os.path.exists("user_data"): + os.mkdir("user_data") with open(f"user_data/{wallet}.autoRenew", "w") as f: f.write(f"This file is used to disable automations for '{wallet}' wallet.\nDelete this file to enable automations.") return {"Status": "Disabled Automations"}