Add generic module
This commit is contained in:
parent
24adb62df8
commit
a96ebe05aa
@ -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")):
|
||||
|
@ -1,3 +1,4 @@
|
||||
generic.py
|
||||
colorama.py
|
||||
download.py
|
||||
minecraft.py
|
22
oml/modules/generic.py
Normal file
22
oml/modules/generic.py
Normal 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
|
Loading…
Reference in New Issue
Block a user