offline-minecraft-launcher/oml/modules/generic.py
2024-04-27 22:02:44 +02:00

34 lines
740 B
Python

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):
if (
os.path.isfile(cmd) and
os.access(cmd,os.X_OK)
): return cmd
paths = os.environ["PATH"].split(os.pathsep)
if lv["osName"] == "windows":
pathexts = os.environ["PATHEXT"].split(os.pathsep)
for path in paths:
ffile = os.path.join(path,cmd)
if lv["osName"] == "windows":
for pathext in pathexts:
if (
os.path.isfile(ffile + pathext) and
os.access(ffile,os.X_OK)
): return ffile
else:
if (
os.path.isfile(ffile) and
os.access(ffile,os.X_OK)
): return ffile
return None