Add generic module

This commit is contained in:
Fierelier 2022-05-18 14:52:41 +02:00
parent 24adb62df8
commit a96ebe05aa
3 changed files with 23 additions and 6 deletions

View File

@ -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")):

View File

@ -1,3 +1,4 @@
generic.py
colorama.py
download.py
minecraft.py

22
oml/modules/generic.py Normal file
View File

@ -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