From afa043df74ae73e6f48523be542ed9bad66ce60a Mon Sep 17 00:00:00 2001 From: Fierelier Date: Wed, 28 Nov 2018 01:16:25 +0100 Subject: [PATCH] Implemented simple console tool --- UniversalModloader.py | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/UniversalModloader.py b/UniversalModloader.py index e254f2a..d04d54c 100644 --- a/UniversalModloader.py +++ b/UniversalModloader.py @@ -292,8 +292,30 @@ def requestAppPath(): clear() dir = input("Please insert a folder via Drag&Drop:\n") dir = dir.replace('"',"") - if os.path.isdir(dir) == True: - return dir + + if dir == "console": + console() + else: + if os.path.isdir(dir) == True: + return dir + +def console(): + clear() + print("UniversalModloader Console") + print("Version: " +umlVerStr) + print("") + + while True: + cmd = input(os.getcwd()+ ">") + if cmd.startswith("pyc "): + try: + exec(cmd[4:]) + except Exception as e: + print(e) + else: + os.system(cmd) + + print("") def setupVariables(): global appPath @@ -308,6 +330,9 @@ def setupVariables(): else: appPath = sys.argv[1] + if appPath == "console": + console() + if os.path.isdir(appPath) == False: raise NameError("Folder not found: " +appPath)