Skip to content

[Enhancement] 导出整合包-文件选择优化#6115

Open
ToobLac wants to merge 7 commits into
HMCL-dev:mainfrom
ToobLac:pack-native
Open

[Enhancement] 导出整合包-文件选择优化#6115
ToobLac wants to merge 7 commits into
HMCL-dev:mainfrom
ToobLac:pack-native

Conversation

@ToobLac
Copy link
Copy Markdown
Contributor

@ToobLac ToobLac commented May 17, 2026

  • 隐藏版本根目录下 natives-os-arch 文件夹
  • 将文件/文件夹名称放到注释前面
  • 排序时将目录放在前面,按名称排序
  • 修复 Windows 上排除不正确的问题

Resolves #6073 Fixes #6116

顺带提一句,电磁炉在 #5367 中的修复是没有问题的,因为所谓“其他地方”都不会传入目录,不会被他的修改影响到。

@ToobLac ToobLac marked this pull request as ready for review May 17, 2026 10:59
@Glavo
Copy link
Copy Markdown
Member

Glavo commented May 18, 2026

/gemini review

Copy link
Copy Markdown
Contributor

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

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 refactors the modpack file selection UI and filtering logic, introducing a directory-first sorting mechanism and hierarchical level tracking. However, several issues were identified: setting CheckBoxTreeItem values to empty strings breaks file path construction in the export logic, and the use of substringAfter for labels displays incorrect nested paths. Additionally, performing I/O operations like Files.isDirectory inside a comparator significantly impacts performance, and a redundant match method was introduced in the Modpack class that duplicates existing logic in ModAdviser.

Comment thread HMCL/src/main/java/org/jackhuang/hmcl/ui/export/ModpackFileSelectionPage.java Outdated
Comment thread HMCL/src/main/java/org/jackhuang/hmcl/ui/export/ModpackFileSelectionPage.java Outdated
Comment thread HMCLCore/src/main/java/org/jackhuang/hmcl/util/io/FileUtils.java Outdated
Comment on lines +124 to +135
private static boolean match(List<String> l, String fileName) {
for (String s : l) {
if (s.startsWith("regex:")) {
if (fileName.matches(s.substring("regex:".length())))
return true;
} else {
if (fileName.equals(s))
return true;
}
}
return false;
}
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.

medium

match 方法与 ModAdviser.match 的逻辑完全重复。既然 Modpack 已经依赖于 ModAdviser,建议删除此冗余方法,并直接调用 ModAdviser.match(blackList, path, false),以提高代码的可维护性。

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

故意拆出来的,防止出问题。本来就应该自己用自己的

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.

[Bug] Windows 下 ModAdviser 存在问题 [Bug] 打包整合包时将 natives 默认打包到整合包

2 participants