34 lines
736 B
Python
34 lines
736 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)
|
|
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
|