Repository: HMCL-dev/HMCL (language: java)

Issue:
[Bug] 首次打开启动器时没有创建 HMCL 全局目录
### 平台 | Platform

Windows 11, version 24H2

### 问题描述 | Bug Description

使用 `main` 分支 [`bfa9c1a`](https://github.com/HMCL-dev/HMCL/commit/bfa9c1a697c0e7124bc465d59d9a5b1ff3c7ce24) 的构建。

在新的用户账户/系统上打开 HMCL，或者将原有的 `%APPDATA%\.hmcl` 临时改为其他名字。

确认同意 ToS 后，日志内出现错误，`%APPDATA%\.hmcl` 没有如期出现。第二次打开启动器时仍然要求同意 ToS。

### 启动器崩溃报告 / 启动器日志文件 | Launcher Crash Report / Launcher Log File

Log (*Deleted*)


Discussion / hints:

Fix patch:
diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/Main.java b/HMCL/src/main/java/org/jackhuang/hmcl/Main.java
index c3ca12c4e..2a05c7fce 100644
--- a/HMCL/src/main/java/org/jackhuang/hmcl/Main.java
+++ b/HMCL/src/main/java/org/jackhuang/hmcl/Main.java
@@ -58,7 +58,7 @@ public static void main(String[] args) {
         System.getProperties().putIfAbsent("javafx.autoproxy.disable", "true");
         System.getProperties().putIfAbsent("http.agent", "HMCL/" + Metadata.VERSION);
 
-        createHMCLCurrentDirectory();
+        createHMCLDirectories();
         LOG.start(Metadata.HMCL_CURRENT_DIRECTORY.resolve("logs"));
 
         checkDirectoryPath();
@@ -83,7 +83,7 @@ public static void exit(int exitCode) {
         System.exit(exitCode);
     }
 
-    private static void createHMCLCurrentDirectory() {
+    private static void createHMCLDirectories() {
         if (!Files.isDirectory(Metadata.HMCL_CURRENT_DIRECTORY)) {
             try {
                 Files.createDirectories(Metadata.HMCL_CURRENT_DIRECTORY);
@@ -99,6 +99,14 @@ private static void createHMCLCurrentDirectory() {
                 showErrorAndExit(i18n("fatal.create_hmcl_current_directory_failure", Metadata.HMCL_CURRENT_DIRECTORY));
             }
         }
+
+        if (!Files.isDirectory(Metadata.HMCL_GLOBAL_DIRECTORY)) {
+            try {
+                Files.createDirectories(Metadata.HMCL_GLOBAL_DIRECTORY);
+            } catch (IOException e) {
+                LOG.warning("Failed to create HMCL global directory " + Metadata.HMCL_GLOBAL_DIRECTORY, e);
+            }
+        }
     }
 
     private static void initIcon() {


Test patch: