From 26752b92007d92676669b90ccd534c300296571b Mon Sep 17 00:00:00 2001 From: Fierelier Date: Fri, 21 Jul 2017 10:19:16 +0200 Subject: [PATCH] Remove drag+drop requirement - program can be used without initializing by drag+drop - added temporary error handling for non-existant folders --- UniversalModloader.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/UniversalModloader.py b/UniversalModloader.py index 5fb24f8..b3774fd 100644 --- a/UniversalModloader.py +++ b/UniversalModloader.py @@ -191,6 +191,14 @@ def mainMenu(): if choice == "2": unloadMods(True); input("Press ENTER to continue.") if choice == "3": openModsFolder() +def requestAppPath(): + while True: + clear() + dir = input("Please insert a folder via Drag&Drop:\n") + dir = dir.replace('"',"") + if os.path.isdir(dir) == True: + return dir + def setupVariables(): global appPath global appName @@ -199,7 +207,14 @@ def setupVariables(): global modPath global originalModPath - appPath = sys.argv[1] + if len(sys.argv) < 2: + appPath = requestAppPath() + else: + appPath = sys.argv[1] + + if os.path.isdir(appPath) == False: + raise NameError("Folder not found: " +appPath) + if os.path.isdir(appPath.replace(" - umlOriginal","")): appPath = appPath.replace(" - umlOriginal","") appName = appPath.replace(os.path.dirname(appPath)+ "\\","") originalAppPath = appPath + " - umlOriginal"