mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2025-01-19 09:45:28 +01:00
Add prototype helper (linux only)
This commit is contained in:
parent
fd162a0d24
commit
e820ba058a
@ -15,6 +15,7 @@ import html
|
|||||||
import zipfile
|
import zipfile
|
||||||
import pathlib
|
import pathlib
|
||||||
import ctypes
|
import ctypes
|
||||||
|
import subprocess
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from socket import gethostname
|
from socket import gethostname
|
||||||
from contextlib import redirect_stderr, suppress
|
from contextlib import redirect_stderr, suppress
|
||||||
@ -81,6 +82,20 @@ class Helpers:
|
|||||||
print(f"Import Error: Unable to load {ex.name} module")
|
print(f"Import Error: Unable to load {ex.name} module")
|
||||||
installer.do_install()
|
installer.do_install()
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def find_java_installs():
|
||||||
|
try:
|
||||||
|
paths = subprocess.check_output(
|
||||||
|
["/usr/bin/update-alternatives", "--list", "java"], encoding="utf8"
|
||||||
|
)
|
||||||
|
|
||||||
|
if re.match("^(/[^/ ]*)+/?$", paths):
|
||||||
|
return paths.split("\n")
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
print("Java Detect Error: ", e)
|
||||||
|
logger.error(f"Java Detect Error: {e}")
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def float_to_string(gbs: float):
|
def float_to_string(gbs: float):
|
||||||
s = str(float(gbs) * 1000).rstrip("0").rstrip(".")
|
s = str(float(gbs) * 1000).rstrip("0").rstrip(".")
|
||||||
|
1
main.py
1
main.py
@ -224,6 +224,7 @@ if __name__ == "__main__":
|
|||||||
controller_setup_thread.join()
|
controller_setup_thread.join()
|
||||||
|
|
||||||
Console.info("Crafty has fully started and is now ready for use!")
|
Console.info("Crafty has fully started and is now ready for use!")
|
||||||
|
console.debug(helper.find_java_installs())
|
||||||
crafty_prompt.prompt = f"Crafty Controller v{helper.get_version_string()} > "
|
crafty_prompt.prompt = f"Crafty Controller v{helper.get_version_string()} > "
|
||||||
|
|
||||||
if not args.daemon:
|
if not args.daemon:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user