提早非法路径检查 (#5259)

Co-authored-by: Glavo <[email protected]>
This commit is contained in:
辞庐andGlavo authored and GitHub committed 2026-01-20 21:50:34 +08:00
1 parent 66e75fdc9d
commit 38612e5d6c
2 files changed
+12 -11

No files matched your search

@@ -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 {