only:flexible jar name

This commit is contained in:
Andrey 2024-08-15 12:36:05 -04:00
parent 01fc8c915c
commit b285e1caf0
2 changed files with 17 additions and 6 deletions

View File

@ -30,7 +30,7 @@ import static com.rusefi.core.FindFileHelper.findSrecFile;
public class Autoupdate { public class Autoupdate {
private static final Logging log = getLogging(Autoupdate.class); private static final Logging log = getLogging(Autoupdate.class);
private static final int VERSION = 20240812; private static final int VERSION = 20240815;
private static final String LOGO_PATH = "/com/rusefi/"; private static final String LOGO_PATH = "/com/rusefi/";
private static final String LOGO = LOGO_PATH + "logo.png"; private static final String LOGO = LOGO_PATH + "logo.png";
@ -110,12 +110,13 @@ public class Autoupdate {
} }
private static void startConsole(String[] args) { private static void startConsole(String[] args) {
URLClassLoader jarClassLoader = null; URLClassLoader jarClassLoader;
String consoleJarFileName = ConnectionAndMeta.getRusEfiConsoleJarName();
try { try {
jarClassLoader = AutoupdateUtil.getClassLoaderByJar(RUSEFI_CONSOLE_JAR); jarClassLoader = AutoupdateUtil.getClassLoaderByJar(consoleJarFileName);
} catch (MalformedURLException e) { } catch (MalformedURLException e) {
log.error("Failed to start", e); log.error("Failed to start", e);
throw new IllegalStateException("Problem with " + RUSEFI_CONSOLE_JAR, e); throw new IllegalStateException("Problem with " + consoleJarFileName, e);
} }
// we want to make sure that files are available to write so we use reflection to get lazy class initialization // we want to make sure that files are available to write so we use reflection to get lazy class initialization
log.info("Running console with " + Arrays.toString(args)); log.info("Running console with " + Arrays.toString(args));

View File

@ -1,5 +1,7 @@
package com.rusefi.core.net; package com.rusefi.core.net;
import org.jetbrains.annotations.NotNull;
import javax.net.ssl.*; import javax.net.ssl.*;
import java.io.*; import java.io.*;
import java.net.HttpURLConnection; import java.net.HttpURLConnection;
@ -36,8 +38,16 @@ public class ConnectionAndMeta {
} }
public static String getWhiteLabel(Properties properties) { public static String getWhiteLabel(Properties properties) {
return Optional.ofNullable(properties.getProperty("white_label")).map(String::trim) return getStringProperty(properties, "white_label", DEFAULT_WHITE_LABEL);
.orElse(DEFAULT_WHITE_LABEL); }
public static String getRusEfiConsoleJarName() {
return getStringProperty(getProperties(), "console_jar", "rusefi_console.jar");
}
private static @NotNull String getStringProperty(Properties properties, String key, String defaultValue) {
return Optional.ofNullable(properties.getProperty(key)).map(String::trim)
.orElse(defaultValue);
} }
public static String getSignatureWhiteLabel() { public static String getSignatureWhiteLabel() {