i can java (#5014)

This commit is contained in:
David Holdeman 2023-01-29 09:01:54 -06:00 committed by GitHub
parent fbc053139f
commit d0316c1570
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 7 deletions

View File

@ -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);

View File

@ -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;
}