Remove build.version dependency
- Read version only from JAR manifest (Implementation-Version) - Remove all VERSION_FILE references from Bootstrap - Remove build.version from scanLocalFiles() and update methods
This commit is contained in:
@@ -12,7 +12,6 @@ import java.util.jar.Attributes;
|
||||
import java.util.jar.Manifest;
|
||||
|
||||
public class Bootstrap {
|
||||
private static final String VERSION_FILE = "build.version";
|
||||
private static final String JAR_NAME = "zernmclauncher.jar";
|
||||
private static final String BASE_URL = "http://87.120.187.36:1582";
|
||||
private static final int BUFFER_SIZE = 8192;
|
||||
@@ -85,12 +84,6 @@ public class Bootstrap {
|
||||
}
|
||||
} catch (Exception ignored) {}
|
||||
|
||||
// Fallback: из build.version
|
||||
Path f = baseDir.resolve(VERSION_FILE);
|
||||
try {
|
||||
if (Files.exists(f)) return Files.readString(f).trim();
|
||||
} catch (Exception ignored) {}
|
||||
|
||||
return "0.0.0";
|
||||
}
|
||||
|
||||
@@ -207,8 +200,7 @@ public class Bootstrap {
|
||||
}
|
||||
}
|
||||
|
||||
// 6. Записываем новую версию
|
||||
Files.writeString(baseDir.resolve(VERSION_FILE), serverVersion);
|
||||
// 6. Версия уже в манифесте JAR
|
||||
log("Обновлено до v" + serverVersion);
|
||||
|
||||
} catch (Exception e) {
|
||||
@@ -336,7 +328,6 @@ public class Bootstrap {
|
||||
// Сканируем основную директорию
|
||||
try (DirectoryStream<Path> stream = Files.newDirectoryStream(baseDir)) {
|
||||
for (Path p : stream) {
|
||||
if (p.getFileName().toString().equals("build.version")) continue;
|
||||
if (p.getFileName().toString().equals("logs")) continue;
|
||||
if (p.getFileName().toString().equals("data")) continue;
|
||||
|
||||
@@ -502,7 +493,7 @@ public class Bootstrap {
|
||||
Files.move(tmp, jarFile, StandardCopyOption.REPLACE_EXISTING);
|
||||
if (Files.exists(backup)) Files.delete(backup);
|
||||
|
||||
Files.writeString(baseDir.resolve(VERSION_FILE), newVersion);
|
||||
// Версия уже в манифесте JAR
|
||||
log("Обновлено до v" + newVersion + " (JAR метод)");
|
||||
} else {
|
||||
throw new IOException("Сервер вернул код: " + conn.getResponseCode());
|
||||
|
||||
Reference in New Issue
Block a user