From e34695527dff6f6b0feef093cfcaf41e93e2c26c Mon Sep 17 00:00:00 2001
From: Anton Bolshakov <blshkv@users.noreply.github.com>
Date: Mon, 4 Jul 2022 12:02:05 +0800
Subject: [PATCH 1/2] config/setup.py: check if copy_tree was sucessful

it would be better to check for the exit error code, but I didn't find it.
---
 wifipumpkin3/core/config/setup.py | 35 +++++++++++++++++++++----------
 1 file changed, 24 insertions(+), 11 deletions(-)

diff --git a/wifipumpkin3/core/config/setup.py b/wifipumpkin3/core/config/setup.py
index 3678524..9aaee7a 100644
--- a/wifipumpkin3/core/config/setup.py
+++ b/wifipumpkin3/core/config/setup.py
@@ -1,4 +1,3 @@
-
 import os
 from distutils.dir_util import copy_tree
 import wifipumpkin3.core.utility.constants as C
@@ -10,25 +9,39 @@
 
 def create_user_dir_config():
     user_config_dir = C.user_config_dir
+    copy_sucessful = False
+
     if not os.path.isdir(user_config_dir):
         print(
             display_messages(
                 "creating config user dir on: {}".format(
-                    setcolor(user_config_dir, color="red")
+                    setcolor(user_config_dir, color="orange")
                 ),
                 info=True,
             )
         )
-        os.makedirs(user_config_dir, exist_ok=True)
         # force copy all files `config` to user_config_dir
         for folder in C.config_dir_packager_data:
             if os.path.isdir(folder):
+                os.makedirs(user_config_dir, exist_ok=True)
                 copy_tree(folder, user_config_dir + "/config")
-        exit(print(
-            display_messages(
-                "the user config has been create {}, please restart the wp3!".format(
-                    setcolor("sucessfully", color="green")
-                ),
-                sucess=True,
-            )
-        ))
\ No newline at end of file
+                copy_sucessful = true
+
+        if (copy_sucessful):
+            exit(print(
+                display_messages(
+                    "the user config has been created {}, please restart the wp3".format(
+                        setcolor("sucessfully", color="green")
+                    ),
+                    sucess=True,
+                )
+            ))
+        else:
+            exit(print(
+                display_messages(
+                    "the user config has {} been created, please investigate!".format(
+                        setcolor("not", color="red")
+                    ),
+                    error=True,
+                )
+            ))

From 20348a1b956aac25857762438cfe822536a493e1 Mon Sep 17 00:00:00 2001
From: Anton Bolshakov <blshkv@users.noreply.github.com>
Date: Mon, 4 Jul 2022 12:05:24 +0800
Subject: [PATCH 2/2] Update setup.py

---
 wifipumpkin3/core/config/setup.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/wifipumpkin3/core/config/setup.py b/wifipumpkin3/core/config/setup.py
index 9aaee7a..c064e4e 100644
--- a/wifipumpkin3/core/config/setup.py
+++ b/wifipumpkin3/core/config/setup.py
@@ -25,7 +25,7 @@ def create_user_dir_config():
             if os.path.isdir(folder):
                 os.makedirs(user_config_dir, exist_ok=True)
                 copy_tree(folder, user_config_dir + "/config")
-                copy_sucessful = true
+                copy_sucessful=True
 
         if (copy_sucessful):
             exit(print(
