Skip to content

Conversation

@burningtnt
Copy link
Member

No description provided.

if (path != null) {
Path parent = path.getParent();
if (parent != null) {
System.setProperty("user.dir", parent.toAbsolutePath().toString());
Copy link
Member

Choose a reason for hiding this comment

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

这样做真的没问题吗?我觉得会导致大量奇怪的问题。

Copy link
Member Author

@burningtnt burningtnt Dec 11, 2025

Choose a reason for hiding this comment

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

image

现版本的 HMCL 会因为无法创建 .hmcl 文件夹而直接拒绝启动

Copy link
Member

@Glavo Glavo Dec 11, 2025

Choose a reason for hiding this comment

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

现版本的 HMCL 会因为无法创建 .hmcl 文件夹而直接拒绝启动

直接拒绝启动也比出现一大堆微妙的问题更好。

这个 PR 非常明显的不能正常工作。比如 Metadata 比你这段代码更早初始化,你设置 user.dir 的时候 Metadata.CURRENT_DIRECTORY 早就初始化完了,很多地方都不会遵循你这里新设置的路径。而且我怀疑有更多位置的代码可能无法遵循这里设置的路径。

@burningtnt burningtnt marked this pull request as draft December 11, 2025 12:38
@burningtnt

This comment was marked as outdated.

@burningtnt burningtnt closed this Dec 11, 2025
@burningtnt burningtnt deleted the fix/working-directory-windows branch December 11, 2025 12:50
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.

2 participants