瀏覽代碼

Fix ini file not being generated because of #4d3156

Cammy 5 年之前
父節點
當前提交
d5d1ad03e0
共有 1 個文件被更改,包括 13 次插入7 次删除
  1. 13 7
      pyinstalive/startup.py

+ 13 - 7
pyinstalive/startup.py

@@ -30,18 +30,24 @@ except ImportError:
 
 def validate_inputs(config, args, unknown_args):
     error_arr = []
+    banner_shown = False
     try:
         if args.configpath:
             if os.path.isfile(args.configpath):
                 pil.config_path = args.configpath
             else:
-                if os.path.isfile(pil.config_path):
-                    logger.warn("Custom config path is invalid, falling back to default path: {:s}".format(pil.config_path))
-                    logger.separator()
-                else:  # Create new config if it doesn't exist
-                    logger.banner()
-                    helpers.new_config()
-                    return False
+                logger.banner()
+                banner_shown = True
+                logger.warn("Custom config path is invalid, falling back to default path: {:s}".format(pil.config_path))
+                pil.config_path = os.path.join(os.getcwd(), "pyinstalive.ini")
+                logger.separator()
+
+
+        if not os.path.isfile(pil.config_path):  # Create new config if it doesn't exist
+            if not banner_shown:
+                logger.banner()
+            helpers.new_config()
+            return False
         pil.config_path = os.path.realpath(pil.config_path)
         config.read(pil.config_path)