diff --git a/java_console/autoupdate/src/main/java/com/rusefi/autoupdate/Autoupdate.java b/java_console/autoupdate/src/main/java/com/rusefi/autoupdate/Autoupdate.java index 4ea595b02f..e2874706dc 100644 --- a/java_console/autoupdate/src/main/java/com/rusefi/autoupdate/Autoupdate.java +++ b/java_console/autoupdate/src/main/java/com/rusefi/autoupdate/Autoupdate.java @@ -40,8 +40,8 @@ public class Autoupdate { System.out.println("Snapshot requested"); if (bundleFullName != null) { System.out.println("Handling " + bundleFullName); - String branchName = bundleFullName.split(".")[1]; - if ( branchName == "snapshot" ) { + String branchName = bundleFullName.split("\\.")[1]; + if ( branchName.equals("snapshot") ) { handleBundle(bundleFullName, mode, ConnectionAndMeta.BASE_URL_LATEST); } else { handleBundle(bundleFullName, mode, String.format(ConnectionAndMeta.BASE_URL_LTS, branchName)); @@ -82,7 +82,7 @@ public class Autoupdate { private static void handleBundle(String bundleFullName, UpdateMode mode, String baseUrl) { try { - String boardName = bundleFullName.split(".")[2]; + String boardName = bundleFullName.split("\\.")[2]; String zipFileName = "rusefi_bundle_" + boardName + "_autoupdate" + ".zip"; ConnectionAndMeta connectionAndMeta = new ConnectionAndMeta(zipFileName).invoke(baseUrl); System.out.println("Remote file " + zipFileName); diff --git a/java_console/shared_io/src/main/java/com/rusefi/core/io/BundleUtil.java b/java_console/shared_io/src/main/java/com/rusefi/core/io/BundleUtil.java index 1cec8db5ba..1bec0b9c14 100644 --- a/java_console/shared_io/src/main/java/com/rusefi/core/io/BundleUtil.java +++ b/java_console/shared_io/src/main/java/com/rusefi/core/io/BundleUtil.java @@ -8,7 +8,7 @@ import java.io.FileReader; import java.io.IOException; import java.nio.file.Path; import java.nio.file.Paths; -import java.nio.file.FileSystemNotFoundException; +import java.nio.file.InvalidPathException; import java.util.Date; public class BundleUtil { @@ -18,12 +18,12 @@ public class BundleUtil { @Nullable public static String readBundleFullName() { try { - Path path = Paths.get(".."); - String fullName = path.getFileName().toString(); + Path path = Paths.get("").toAbsolutePath(); + String fullName = path.getParent().getFileName().toString(); if (fullName.length() < 3) return null; // just paranoia check return fullName; - } catch (FileSystemNotFoundException e) { + } catch (InvalidPathException e) { System.err.println(new Date() + ": BundleUtil: Error reading bundle name"); return null; }