Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions HMCL/src/main/java/org/jackhuang/hmcl/EntryPoint.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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();
Expand Down
12 changes: 12 additions & 0 deletions HMCLBoot/src/main/java/org/jackhuang/hmcl/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Copy link

Copilot AI Jan 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error dialog title "ERROR" is hardcoded in English, while other error dialogs in this file use resourceBundle.getString("boot.message.error") for the title. While the comment explains that Chinese characters cannot be rendered properly with exclamation marks in the path (hence the English error message), the title could potentially use the same approach as showErrorAndExit() for consistency, or at least use a lowercase "Error" to match the default title pattern in SwingUtils.showErrorDialog().

Suggested change
SwingUtils.showErrorDialog("Exclamation mark(!) is not allowed in the path where HMCL is in.\n" + "The path is " + currentDir, "ERROR");
ResourceBundle resourceBundle = BootProperties.getResourceBundle();
String errorTitle = resourceBundle.getString("boot.message.error");
SwingUtils.showErrorDialog("Exclamation mark(!) is not allowed in the path where HMCL is in.\n" + "The path is " + currentDir, errorTitle);

Copilot uses AI. Check for mistakes.
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 {
Expand Down
Loading