mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2024-08-30 18:23:09 +00:00
Add a helper to better detect if java is installed
This commit is contained in:
parent
c434833208
commit
cefa6e8084
@ -15,6 +15,7 @@ import html
|
|||||||
import zipfile
|
import zipfile
|
||||||
import pathlib
|
import pathlib
|
||||||
import ctypes
|
import ctypes
|
||||||
|
import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
import itertools
|
import itertools
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
@ -145,6 +146,24 @@ class Helpers:
|
|||||||
logger.error(f"Unable to resolve remote bedrock download url! \n{e}")
|
logger.error(f"Unable to resolve remote bedrock download url! \n{e}")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
def detect_java(self):
|
||||||
|
if len(self.find_java_installs()) > 0:
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
# We'll use this as a fallback for systems
|
||||||
|
# That do not properly setup reg keys or
|
||||||
|
# Update alternatives
|
||||||
|
if self.is_os_windows():
|
||||||
|
if shutil.which("java.exe"):
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
return False
|
||||||
|
else:
|
||||||
|
if shutil.which("java"):
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
return False
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def find_java_installs():
|
def find_java_installs():
|
||||||
# If we're windows return oracle java versions,
|
# If we're windows return oracle java versions,
|
||||||
|
Loading…
Reference in New Issue
Block a user