From fa5a99e87c6a7dd98a922d45d682483ac5156927 Mon Sep 17 00:00:00 2001 From: Taka Date: Thu, 21 Jul 2022 00:40:43 +1000 Subject: [PATCH] Changed how Java is detected (and reported) from the PATH. --- vasl_templates/webapp/main.py | 5 +++-- vasl_templates/webapp/utils.py | 5 ++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/vasl_templates/webapp/main.py b/vasl_templates/webapp/main.py index 3fb3ac0..a5606f1 100644 --- a/vasl_templates/webapp/main.py +++ b/vasl_templates/webapp/main.py @@ -14,7 +14,7 @@ from flask import request, render_template, jsonify, send_file, redirect, url_fo from vasl_templates.webapp import app, shutdown_event from vasl_templates.webapp.vassal import VassalShim -from vasl_templates.webapp.utils import MsgStore, get_java_version, parse_int +from vasl_templates.webapp.utils import MsgStore, get_java_path, get_java_version, parse_int import vasl_templates.webapp.config.constants from vasl_templates.webapp.config.constants import BASE_DIR, DATA_DIR, IS_FROZEN from vasl_templates.webapp import globvars @@ -185,8 +185,9 @@ def get_program_info(): params[ "VASL_VERSION" ] = globvars.vasl_mod.vasl_version params[ "VASL_REAL_VERSION" ] = globvars.vasl_mod.vasl_real_version for key in [ "VASSAL_DIR", "VASL_MOD", "VASL_EXTNS_DIR", "BOARDS_DIR", - "JAVA_PATH", "WEBDRIVER_PATH", "CHAPTER_H_NOTES_DIR", "USER_FILES_DIR" ]: + "WEBDRIVER_PATH", "CHAPTER_H_NOTES_DIR", "USER_FILES_DIR" ]: params[ key ] = app.config.get( key ) + params[ "JAVA_PATH" ] = get_java_path() params[ "JAVA_VERSION" ] = get_java_version() def parse_timestamp( val ): diff --git a/vasl_templates/webapp/utils.py b/vasl_templates/webapp/utils.py index 119f31f..2b67950 100644 --- a/vasl_templates/webapp/utils.py +++ b/vasl_templates/webapp/utils.py @@ -246,10 +246,9 @@ def get_java_path(): if os.path.isfile( fname ): java_path = fname - # check if we've found a Java runtime + # check the PATH if not java_path: - # nope - hope that there's one on the PATH - java_path = "java" + java_path = shutil.which( "java" ) return java_path