From 20bb8233b9fb4ccce65c8ff01df665806791c315 Mon Sep 17 00:00:00 2001 From: SashegDev Date: Wed, 19 Aug 2026 12:15:27 +0000 Subject: [PATCH] =?UTF-8?q?v1.0.16.15=20=E2=80=94=20codesign:=20self-signe?= =?UTF-8?q?d=20Zern.cc=20exe=20signature=20(osslsigncode,=20digicert=20ts)?= =?UTF-8?q?=20+=20cli=20in=20bin=20layout=20+=20cli-jfx=20variant?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sashegdev/zernmc/launcher/Bootstrap.java | 31 +++++- launcher/launcher/pom.xml | 95 +++++++++++++++++++ launcher/pom.xml | 2 +- 3 files changed, 126 insertions(+), 2 deletions(-) diff --git a/launcher/bootstrap/src/main/java/me/sashegdev/zernmc/launcher/Bootstrap.java b/launcher/bootstrap/src/main/java/me/sashegdev/zernmc/launcher/Bootstrap.java index 27e360c..f804db8 100644 --- a/launcher/bootstrap/src/main/java/me/sashegdev/zernmc/launcher/Bootstrap.java +++ b/launcher/bootstrap/src/main/java/me/sashegdev/zernmc/launcher/Bootstrap.java @@ -47,8 +47,37 @@ public class Bootstrap { return binDir.resolve(JAR_NAME); } + private static Path resolveBaseDir() { + // 1) Стартуем от папки, где лежит сам .exe (для launch4j codeSource -> путь к exe). + Path exeDir = null; + try { + java.security.CodeSource cs = Bootstrap.class.getProtectionDomain().getCodeSource(); + if (cs != null && cs.getLocation() != null) { + Path loc = Paths.get(cs.getLocation().toURI()).toAbsolutePath(); + if (!Files.isDirectory(loc)) { + loc = loc.getParent(); // jar/exe -> его папка + } + exeDir = loc; + } + } catch (Exception ignored) { + } + if (exeDir != null) { + // exe в bin/ -> база родитель (lib/jre21/assets в корне) + Path parent = exeDir.getParent(); + Path candidates[] = { exeDir, parent }; // порядок: корень дистрибутива, затем родитель + for (Path c : candidates) { + if (c == null) continue; + if (Files.exists(c.resolve("bin").resolve(JAR_NAME))) { + return c; + } + } + } + // 2) Fallback: текущая рабочая папка (старое поведение). + return Paths.get("").toAbsolutePath(); + } + public static void main(String[] args) throws Exception { - baseDir = Paths.get("").toAbsolutePath(); + baseDir = resolveBaseDir(); binDir = baseDir.resolve("bin"); Files.createDirectories(binDir); logDir = baseDir.resolve("logs"); diff --git a/launcher/launcher/pom.xml b/launcher/launcher/pom.xml index 71df809..0427856 100644 --- a/launcher/launcher/pom.xml +++ b/launcher/launcher/pom.xml @@ -191,6 +191,7 @@ console false me.sashegdev.zernmc.launcher.Bootstrap + --cli lib/jre21 21 @@ -208,6 +209,38 @@ + + + + l4j-cli-jfx + package + + launch4j + + + ../../server/builds/zernmc-cli-jfx.exe + ../../server/builds/zernmc-bootstrap.jar + console + false + me.sashegdev.zernmc.launcher.Bootstrap + --jfx + + lib/jre21 + 21 + + + ${project.version}.${hotfix} + ${project.version}.${hotfix} + ZernMC Launcher CLI + JFX + ${project.version}.${hotfix} + ${project.version}.${hotfix} + ZernMC CLI JFX + ZernMC + zernmc-cli-jfx + zernmc-cli-jfx.exe + + + @@ -271,6 +304,12 @@ + + + + @@ -279,6 +318,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ZernMC Launcher diff --git a/launcher/pom.xml b/launcher/pom.xml index 5efa756..7550914 100644 --- a/launcher/pom.xml +++ b/launcher/pom.xml @@ -20,7 +20,7 @@ 1.0.16 - 14 + 15 21 21 UTF-8