offline-minecraft-launcher/oml/modules/generic.py

34 lines
740 B
Python
Raw Normal View History

2022-05-18 12:52:41 +00:00
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):
2024-04-27 19:58:44 +00:00
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:
2024-04-27 20:02:44 +00:00
ffile = os.path.join(path,cmd)
2024-04-27 19:58:44 +00:00
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