Repository navigation
在选择磁盘根目录作为游戏目录时弹出警告 - #6203
在选择磁盘根目录作为游戏目录时弹出警告#6203
Conversation
|
en? |
|
/gemini review |
There was a problem hiding this comment.
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.
|
建议在选择磁盘根目录作为游戏目录时,自动将游戏目录更改为 .minecraft 文件夹。如果 .minecraft 已经存在,则回退到 .minecraft.1,.2, .3…… |
| 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, |
There was a problem hiding this comment.
这个方法本来不就在 FX 线程上运行吗?不要到处乱放 Platform.runLater 啊,搞得像这个方法可以在其他线程上调用一样。
|
@codex review |
There was a problem hiding this comment.
💡 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()))) { |
There was a problem hiding this comment.
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 👍 / 👎.
使用磁盘根目录作为游戏文件夹可能会导致无法启动游戏