Add Java check
This commit is contained in:
parent
749e86df02
commit
24adb62df8
@ -22,9 +22,16 @@ if lv["osName"] == "":
|
|||||||
if lv["osVersion"] == "":
|
if lv["osVersion"] == "":
|
||||||
lv["osVersion"] = platform.version()
|
lv["osVersion"] = platform.version()
|
||||||
|
|
||||||
|
print(colored(colorama.Fore.GREEN,"Checking for Java..."))
|
||||||
|
global javaExe
|
||||||
|
javaExe = shutil.which(lv["java"])
|
||||||
|
if javaExe == None:
|
||||||
|
print(colored(colorama.Fore.RED,"Java wasn't found at '" +lv["java"]+ "'. Please configure java in config.ini."))
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
if lv["jvmArch"] == "":
|
if lv["jvmArch"] == "":
|
||||||
print(colored(colorama.Fore.GREEN,"Querying JVM architecture..."))
|
print(colored(colorama.Fore.GREEN,"Querying JVM architecture..."))
|
||||||
if "64-Bit" in subprocess.check_output([lv["java"],"-version"]).decode("utf-8"):
|
if "64-Bit" in subprocess.check_output([javaExe,"-version"]).decode("utf-8"):
|
||||||
lv["jvmArch"] = "amd64"
|
lv["jvmArch"] = "amd64"
|
||||||
else:
|
else:
|
||||||
lv["jvmArch"] = "x86"
|
lv["jvmArch"] = "x86"
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
print(colored(colorama.Fore.GREEN,"\nLaunching Minecraft..."))
|
print(colored(colorama.Fore.GREEN,"\nLaunching Minecraft..."))
|
||||||
if lv["console"] == "1":
|
if lv["console"] == "1":
|
||||||
proc = subprocess.Popen([lv["java"]] + args)
|
proc = subprocess.Popen([javaExe] + args)
|
||||||
rtn = proc.wait()
|
rtn = proc.wait()
|
||||||
if rtn != 0: print(colored(colorama.Fore.RED,"> Launch failed: ") +"return isn't 0",file=sys.stderr)
|
if rtn != 0: print(colored(colorama.Fore.RED,"> Launch failed: ") +"return isn't 0",file=sys.stderr)
|
||||||
|
sys.exit(rtn)
|
||||||
else:
|
else:
|
||||||
pkwargs = {
|
pkwargs = {
|
||||||
"stdout": subprocess.DEVNULL,
|
"stdout": subprocess.DEVNULL,
|
||||||
@ -10,4 +11,4 @@ else:
|
|||||||
"stderr": subprocess.DEVNULL
|
"stderr": subprocess.DEVNULL
|
||||||
}
|
}
|
||||||
if lv["osName"] == "windows": pkwargs["creationflags"] = 0x00000008
|
if lv["osName"] == "windows": pkwargs["creationflags"] = 0x00000008
|
||||||
subprocess.Popen([lv["java"] + "w"] + args,**pkwargs)
|
subprocess.Popen([shutil.which(lv["java"] + "w")] + args,**pkwargs)
|
Loading…
Reference in New Issue
Block a user