Skip to content

在选择磁盘根目录作为游戏目录时弹出警告#6203

Open
CiiLu wants to merge 3 commits into
HMCL-dev:mainfrom
CiiLu:ppathhh
Open

在选择磁盘根目录作为游戏目录时弹出警告#6203
CiiLu wants to merge 3 commits into
HMCL-dev:mainfrom
CiiLu:ppathhh

Conversation

@CiiLu

@CiiLu CiiLu commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

使用磁盘根目录作为游戏文件夹可能会导致无法启动游戏

2025-03-22 09:45:29,496 main ERROR Error processing element Queue ([Appenders: null]): CLASS_NOT_FOUND
[09:45:29] [main/INFO]: ModLauncher running: args [--username, lzz1216, --version, 1.16.5-Forge-OptiFine, --gameDir, D:\, --assetsDir, D:\assets, --assetIndex, 1.16, --uuid, 020cd6f4469a468d8034ce041fc9ae00, --accessToken, ❄❄❄❄❄❄❄❄, --userType, msa, --versionType, HMCL 3.6.11, --width, 854, --height, 480, --tweakClass, optifine.OptiFineTweaker, --launchTarget, fmlclient, --fml.forgeVersion, 36.2.42, --fml.mcVersion, 1.16.5, --fml.forgeGroup, net.minecraftforge, --fml.mcpVersion, 20210115.111550]
[09:45:29] [main/INFO]: ModLauncher 8.1.3+8.1.3+main-8.1.x.c94d18ec starting: java version 1.8.0_51 by Oracle Corporation
[09:45:29] [main/WARN]: LEGACY JDK DETECTED, SECURED JAR HANDLING DISABLED
[09:45:29] [main/INFO]: OptiFineTransformationService.onLoad
[09:45:29] [main/INFO]: OptiFine ZIP file: D:\libraries\optifine\OptiFine\1.16.5_HD_U_G8\OptiFine-1.16.5_HD_U_G8.jar
[09:45:29] [main/INFO]: Target.PRE_CLASS is available
[09:45:29] [main/INFO]: Added Lets Encrypt root certificates as additional trust
[09:45:29] [main/INFO]: SpongePowered MIXIN Subsystem Version=0.8.4 Source=file:/D:/libraries/org/spongepowered/mixin/0.8.4/mixin-0.8.4.jar Service=ModLauncher Env=CLIENT
[09:45:29] [main/INFO]: OptiFineTransformationService.initialize
[09:45:29] [main/INFO]: [java.lang.ThreadGroup:uncaughtException:1052]: java.lang.NullPointerException
[09:45:29] [main/INFO]: [java.lang.ThreadGroup:uncaughtException:1052]: 	at java.nio.file.Files.provider(Files.java:97)
[09:45:29] [main/INFO]: [java.lang.ThreadGroup:uncaughtException:1052]: 	at java.nio.file.Files.readAttributes(Files.java:1737)
[09:45:29] [main/INFO]: [java.lang.ThreadGroup:uncaughtException:1052]: 	at java.nio.file.Files.isDirectory(Files.java:2192)
[09:45:29] [main/INFO]: [java.lang.ThreadGroup:uncaughtException:1052]: 	at net.minecraftforge.fml.loading.FileUtils.getOrCreateDirectory(FileUtils.java:23)
[09:45:29] [main/INFO]: [java.lang.ThreadGroup:uncaughtException:1052]: 	at net.minecraftforge.fml.loading.FMLPaths.loadAbsolutePaths(FMLPaths.java:62)
[09:45:29] [main/INFO]: [java.lang.ThreadGroup:uncaughtException:1052]: 	at net.minecraftforge.fml.loading.FMLPaths.setup(FMLPaths.java:52)
[09:45:29] [main/INFO]: [java.lang.ThreadGroup:uncaughtException:1052]: 	at net.minecraftforge.fml.loading.FMLServiceProvider.initialize(FMLServiceProvider.java:65)
[09:45:29] [main/INFO]: [java.lang.ThreadGroup:uncaughtException:1052]: 	at cpw.mods.modlauncher.TransformationServiceDecorator.onInitialize(TransformationServiceDecorator.java:68)
[09:45:29] [main/INFO]: [java.lang.ThreadGroup:uncaughtException:1052]: 	at cpw.mods.modlauncher.TransformationServicesHandler.lambda$initialiseTransformationServices$7(TransformationServicesHandler.java:107)
[09:45:29] [main/INFO]: [java.lang.ThreadGroup:uncaughtException:1052]: 	at cpw.mods.modlauncher.TransformationServicesHandler$$Lambda$108/1278254413.accept(Unknown Source)
[09:45:29] [main/INFO]: [java.lang.ThreadGroup:uncaughtException:1052]: 	at java.util.HashMap$Values.forEach(HashMap.java:972)
[09:45:29] [main/INFO]: [java.lang.ThreadGroup:uncaughtException:1052]: 	at cpw.mods.modlauncher.TransformationServicesHandler.initialiseTransformationServices(TransformationServicesHandler.java:107)
[09:45:29] [main/INFO]: [java.lang.ThreadGroup:uncaughtException:1052]: 	at cpw.mods.modlauncher.TransformationServicesHandler.initializeTransformationServices(TransformationServicesHandler.java:59)
[09:45:29] [main/INFO]: [java.lang.ThreadGroup:uncaughtException:1052]: 	at cpw.mods.modlauncher.Launcher.run(Launcher.java:76)
[09:45:29] [main/INFO]: [java.lang.ThreadGroup:uncaughtException:1052]: 	at cpw.mods.modlauncher.Launcher.main(Launcher.java:66)
Exception in thread "main" 

@Minecraft269

Copy link
Copy Markdown

en?

@Minecraft269

Copy link
Copy Markdown

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a warning dialog when users attempt to set the disk root directory as their game folder, adding corresponding localization strings. However, the implementation introduces several critical issues: a potential NullPointerException when resolving relative paths, thread blocking and leak risks due to waiting on a CompletableFuture in a background thread, and unnecessary thread switching since the actual save logic is still dispatched back to the JavaFX thread. The reviewer recommends refactoring the save logic to run entirely on the JavaFX main thread using standard callbacks, which simplifies the code and resolves these safety and performance concerns.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread HMCL/src/main/java/org/jackhuang/hmcl/ui/profile/ProfilePage.java
Comment thread HMCL/src/main/java/org/jackhuang/hmcl/ui/profile/ProfilePage.java Outdated
@burningtnt

Copy link
Copy Markdown
Member

建议在选择磁盘根目录作为游戏目录时,自动将游戏目录更改为 .minecraft 文件夹。如果 .minecraft 已经存在,则回退到 .minecraft.1,.2, .3……

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants