From 38612e5d6ca25a67d5485994eac0ad7bcd637a29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=BE=9E=E5=BA=90?= <109708109+CiiLu@users.noreply.github.com> Date: Tue, 20 Jan 2026 21:50:34 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E6=97=A9=E9=9D=9E=E6=B3=95=E8=B7=AF?= =?UTF-8?q?=E5=BE=84=E6=A3=80=E6=9F=A5=20(#5259)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Glavo --- .../src/main/java/org/jackhuang/hmcl/EntryPoint.java | 11 ----------- HMCLBoot/src/main/java/org/jackhuang/hmcl/Main.java | 12 ++++++++++++ 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/EntryPoint.java b/HMCL/src/main/java/org/jackhuang/hmcl/EntryPoint.java index 7f13f54e3..52391c805 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/EntryPoint.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/EntryPoint.java @@ -50,7 +50,6 @@ public final class EntryPoint { LOG.start(Metadata.HMCL_CURRENT_DIRECTORY.resolve("logs")); setupJavaFXVMOptions(); - checkDirectoryPath(); if (OperatingSystem.CURRENT_OS == OperatingSystem.MACOS && !isInsideMacAppBundle()) initIcon(); @@ -192,16 +191,6 @@ public final class EntryPoint { } } - private static void checkDirectoryPath() { - String currentDir = System.getProperty("user.dir", ""); - if (currentDir.contains("!")) { - LOG.error("The current working path contains an exclamation mark: " + currentDir); - // No Chinese translation because both Swing and JavaFX cannot render Chinese character properly when exclamation mark exists in the path. - showErrorAndExit("Exclamation mark(!) is not allowed in the path where HMCL is in.\n" - + "The path is " + currentDir); - } - } - private static void checkJavaFX() { try { SelfDependencyPatcher.patch(); diff --git a/HMCLBoot/src/main/java/org/jackhuang/hmcl/Main.java b/HMCLBoot/src/main/java/org/jackhuang/hmcl/Main.java index 74eefc86b..457dbe814 100644 --- a/HMCLBoot/src/main/java/org/jackhuang/hmcl/Main.java +++ b/HMCLBoot/src/main/java/org/jackhuang/hmcl/Main.java @@ -102,7 +102,19 @@ public final class Main { System.exit(1); } + private static void checkDirectoryPath() { + String currentDir = System.getProperty("user.dir", ""); + if (currentDir.contains("!")) { + SwingUtils.initLookAndFeel(); + System.err.println("The current working path contains an exclamation mark: " + currentDir); + // No Chinese translation because both Swing and JavaFX cannot render Chinese character properly when exclamation mark exists in the path. + SwingUtils.showErrorDialog("Exclamation mark(!) is not allowed in the path where HMCL is in.\n" + "The path is " + currentDir); + System.exit(1); + } + } + public static void main(String[] args) throws Throwable { + checkDirectoryPath(); if (getJavaFeatureVersion(System.getProperty("java.version")) >= MINIMUM_JAVA_VERSION) { EntryPoint.main(args); } else {