i can java (#5014)
This commit is contained in:
parent
a2bb902602
commit
1d66b25f52
|
@ -40,8 +40,8 @@ public class Autoupdate {
|
||||||
System.out.println("Snapshot requested");
|
System.out.println("Snapshot requested");
|
||||||
if (bundleFullName != null) {
|
if (bundleFullName != null) {
|
||||||
System.out.println("Handling " + bundleFullName);
|
System.out.println("Handling " + bundleFullName);
|
||||||
String branchName = bundleFullName.split(".")[1];
|
String branchName = bundleFullName.split("\\.")[1];
|
||||||
if ( branchName == "snapshot" ) {
|
if ( branchName.equals("snapshot") ) {
|
||||||
handleBundle(bundleFullName, mode, ConnectionAndMeta.BASE_URL_LATEST);
|
handleBundle(bundleFullName, mode, ConnectionAndMeta.BASE_URL_LATEST);
|
||||||
} else {
|
} else {
|
||||||
handleBundle(bundleFullName, mode, String.format(ConnectionAndMeta.BASE_URL_LTS, branchName));
|
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) {
|
private static void handleBundle(String bundleFullName, UpdateMode mode, String baseUrl) {
|
||||||
try {
|
try {
|
||||||
String boardName = bundleFullName.split(".")[2];
|
String boardName = bundleFullName.split("\\.")[2];
|
||||||
String zipFileName = "rusefi_bundle_" + boardName + "_autoupdate" + ".zip";
|
String zipFileName = "rusefi_bundle_" + boardName + "_autoupdate" + ".zip";
|
||||||
ConnectionAndMeta connectionAndMeta = new ConnectionAndMeta(zipFileName).invoke(baseUrl);
|
ConnectionAndMeta connectionAndMeta = new ConnectionAndMeta(zipFileName).invoke(baseUrl);
|
||||||
System.out.println("Remote file " + zipFileName);
|
System.out.println("Remote file " + zipFileName);
|
||||||
|
|
|
@ -8,7 +8,7 @@ import java.io.FileReader;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
import java.nio.file.FileSystemNotFoundException;
|
import java.nio.file.InvalidPathException;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
public class BundleUtil {
|
public class BundleUtil {
|
||||||
|
@ -18,12 +18,12 @@ public class BundleUtil {
|
||||||
@Nullable
|
@Nullable
|
||||||
public static String readBundleFullName() {
|
public static String readBundleFullName() {
|
||||||
try {
|
try {
|
||||||
Path path = Paths.get("..");
|
Path path = Paths.get("").toAbsolutePath();
|
||||||
String fullName = path.getFileName().toString();
|
String fullName = path.getParent().getFileName().toString();
|
||||||
if (fullName.length() < 3)
|
if (fullName.length() < 3)
|
||||||
return null; // just paranoia check
|
return null; // just paranoia check
|
||||||
return fullName;
|
return fullName;
|
||||||
} catch (FileSystemNotFoundException e) {
|
} catch (InvalidPathException e) {
|
||||||
System.err.println(new Date() + ": BundleUtil: Error reading bundle name");
|
System.err.println(new Date() + ": BundleUtil: Error reading bundle name");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue