From e3d5d658168d8bee4689fdb72f0f9a756dc5a96a Mon Sep 17 00:00:00 2001 From: Ciilu <109708109+Ciilu@users.noreply.github.com> Date: Sun, 18 Jan 2026 21:37:27 +0800 Subject: [PATCH] UPDATE --- .../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 7f13f54e31..52391c805b 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 static void main(String[] args) { LOG.start(Metadata.HMCL_CURRENT_DIRECTORY.resolve("logs")); setupJavaFXVMOptions(); - checkDirectoryPath(); if (OperatingSystem.CURRENT_OS == OperatingSystem.MACOS && !isInsideMacAppBundle()) initIcon(); @@ -192,16 +191,6 @@ private static void initIcon() { } } - 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 74eefc86b2..b236935fb5 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 @@ static void showErrorAndExit(String[] args) { 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, "ERROR"); + 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 {