Skip to content

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

Merged
Glavo merged 7 commits into
HMCL-dev:mainfrom
CiiLu:ppathhh
Sep 2, 2026
Merged

Glavo merged 7 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
Contributor

en?

@Minecraft269

Copy link
Copy Markdown
Contributor

/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.

@burningtnt

Copy link
Copy Markdown
Member

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

@github-actions github-actions Bot added the 40+ label Jul 17, 2026
return;
}
if (Objects.equals(Path.of(getLocation()).getRoot(), Path.of(getLocation()))) {
Platform.runLater(() -> Controllers.confirm(i18n("game_directory.root"), i18n("message.warning"), MessageDialogPane.MessageType.WARNING,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

这个方法本来不就在 FX 线程上运行吗?不要到处乱放 Platform.runLater 啊,搞得像这个方法可以在其他线程上调用一样。

@Glavo

Glavo commented Aug 26, 2026

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1e3bbf929f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

});
return;
}
if (Objects.equals(Path.of(getLocation()).getRoot(), Path.of(getLocation()))) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Restore saving for non-root game directories

When the selected path is any normal directory, this condition is false and onSave() returns without adding or updating the game directory or closing the page. This breaks the primary create/edit flow for paths such as .minecraft or a user's home directory; only the root-directory case now performs the original persistence logic. Keep the save logic available for non-root paths and use the confirmation solely to gate the root-path case.

Useful? React with 👍 / 👎.

@github-actions github-actions Bot added 10+ and removed 40+ labels Aug 26, 2026
@Glavo
Glavo merged commit efb4758 into HMCL-dev:main Sep 2, 2026
3 checks passed
@CiiLu
CiiLu deleted the ppathhh branch September 19, 2026 12:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants