diff --git a/offline-minecraft-launcher.py b/offline-minecraft-launcher.py index 6e45928..bb8d1f3 100644 --- a/offline-minecraft-launcher.py +++ b/offline-minecraft-launcher.py @@ -67,12 +67,6 @@ def readFile(file,decode = "utf-8"): if decode == False: return data return data.decode(decode) -def readJsonFile(file): - fileh = open(file,"r") - data = fileh.read() - fileh.close() - return json.loads(data) - def main(): print("Running modules...") for root,dirs,files in os.walk(p(omlPath,"modules")): diff --git a/oml/modules/01_main.modlist b/oml/modules/01_main.modlist index 2a481a8..4086637 100644 --- a/oml/modules/01_main.modlist +++ b/oml/modules/01_main.modlist @@ -1,3 +1,4 @@ +generic.py colorama.py download.py minecraft.py \ No newline at end of file diff --git a/oml/modules/generic.py b/oml/modules/generic.py new file mode 100644 index 0000000..96e02ba --- /dev/null +++ b/oml/modules/generic.py @@ -0,0 +1,22 @@ +global distutils +import distutils.spawn + +global readJsonFile +def readJsonFile(file): + fileh = open(file,"r",encoding="utf-8") + data = fileh.read() + fileh.close() + return json.loads(data) + +global whereis +def whereis(cmd): + rtn = distutils.spawn.find_executable(cmd) + if rtn != None: return rtn + if lv["osName"] != "windows": return None + if not "PATHEXT" in os.environ: return None + for ext in os.environ["PATHEXT"].split(";"): + ext = ext.strip("\t\r\n ") + rtn = distutils.spawn.find_executable(cmd + ext) + if rtn != None: + return rtn + return None \ No newline at end of file