[Bugfix] 修复 #6338: macOS 导出整合包默认名称包含2个后缀名 (#6340)

Fixes #6338
This commit is contained in:
ToobLac authored and GitHub committed 2026-07-08 21:39:37 +08:00
1 parent 74ddbf5623
commit af137e5ff1
1 file changed
+6 -4
@@ -69,6 +69,7 @@ import org.jackhuang.hmcl.util.Lang;
import org.jackhuang.hmcl.util.StringUtils;
import org.jackhuang.hmcl.util.io.FileUtils;
import org.jackhuang.hmcl.util.javafx.SafeStringConverter;
import org.jackhuang.hmcl.util.platform.OperatingSystem;
import org.jetbrains.annotations.NotNullByDefault;
import org.jetbrains.annotations.Nullable;
@@ -323,10 +324,11 @@ public class PersonalizationPage extends StackPane {
private void exportCurrentThemePack(String packId, String version, String packName, String authorName) {
FileChooser chooser = new FileChooser();
chooser.setTitle(i18n("theme_pack.export.title"));
String initialFileName = sanitizeThemePackFileName(packName) + ThemePackExporter.FILE_EXTENSION;
chooser.setInitialFileName(FileUtils.isNameValid(initialFileName)
? initialFileName
: "theme-pack" + ThemePackExporter.FILE_EXTENSION);
String initialFileName = sanitizeThemePackFileName(packName);
chooser.setInitialFileName(
(FileUtils.isNameValid(initialFileName) ? initialFileName : "theme-pack")
+ (OperatingSystem.CURRENT_OS == OperatingSystem.MACOS ? "" : ThemePackExporter.FILE_EXTENSION)
);
chooser.getExtensionFilters().setAll(
new FileChooser.ExtensionFilter(i18n("theme_pack.file"), "*" + ThemePackExporter.FILE_EXTENSION));