|
18 | 18 | package org.jackhuang.hmcl.ui.export; |
19 | 19 |
|
20 | 20 | import javafx.scene.Node; |
| 21 | +import org.jackhuang.hmcl.Metadata; |
21 | 22 | import org.jackhuang.hmcl.mod.ModAdviser; |
22 | 23 | import org.jackhuang.hmcl.mod.ModpackExportInfo; |
23 | 24 | import org.jackhuang.hmcl.mod.mcbbs.McbbsModpackExportTask; |
24 | 25 | import org.jackhuang.hmcl.mod.multimc.MultiMCInstanceConfiguration; |
25 | 26 | import org.jackhuang.hmcl.mod.multimc.MultiMCModpackExportTask; |
26 | 27 | import org.jackhuang.hmcl.mod.server.ServerModpackExportTask; |
27 | 28 | import org.jackhuang.hmcl.setting.Config; |
28 | | -import org.jackhuang.hmcl.setting.ConfigHolder; |
| 29 | +import org.jackhuang.hmcl.setting.FontManager; |
29 | 30 | import org.jackhuang.hmcl.setting.Profile; |
30 | 31 | import org.jackhuang.hmcl.setting.VersionSetting; |
31 | 32 | import org.jackhuang.hmcl.task.Task; |
@@ -123,19 +124,31 @@ public void execute() throws Exception { |
123 | 124 | exported.setPreferredLoginType(config().getPreferredLoginType()); |
124 | 125 | exported.getAuthlibInjectorServers().setAll(config().getAuthlibInjectorServers()); |
125 | 126 |
|
126 | | - zip.putTextFile(exported.toJson(), ConfigHolder.CONFIG_FILENAME); |
| 127 | + zip.putTextFile(exported.toJson(), ".hmcl/hmcl.json"); |
127 | 128 | zip.putFile(tempModpack, "modpack.zip"); |
128 | 129 |
|
129 | | - File bg = new File("bg").getAbsoluteFile(); |
130 | | - if (bg.isDirectory()) |
131 | | - zip.putDirectory(bg.toPath(), "bg"); |
| 130 | + Path bg = Metadata.HMCL_CURRENT_DIRECTORY.resolve("bg"); |
| 131 | + if (!Files.isDirectory(bg)) |
| 132 | + bg = Metadata.CURRENT_DIRECTORY.resolve("bg"); |
| 133 | + if (Files.isDirectory(bg)) |
| 134 | + zip.putDirectory(bg, ".hmcl/bg"); |
132 | 135 |
|
133 | 136 | for (String extension : FXUtils.IMAGE_EXTENSIONS) { |
134 | 137 | String fileName = "background." + extension; |
| 138 | + Path background = Metadata.HMCL_CURRENT_DIRECTORY.resolve(fileName); |
| 139 | + if (!Files.isRegularFile(background)) |
| 140 | + background = Metadata.CURRENT_DIRECTORY.resolve(fileName); |
| 141 | + if (Files.isRegularFile(background)) |
| 142 | + zip.putFile(background, ".hmcl/" + fileName); |
| 143 | + } |
135 | 144 |
|
136 | | - File background = new File(fileName).getAbsoluteFile(); |
137 | | - if (background.isFile()) |
138 | | - zip.putFile(background, "background.png"); |
| 145 | + for (String extension : FontManager.FONT_EXTENSIONS) { |
| 146 | + String fileName = "font." + extension; |
| 147 | + Path font = Metadata.HMCL_CURRENT_DIRECTORY.resolve(fileName); |
| 148 | + if (!Files.isRegularFile(font)) |
| 149 | + font = Metadata.CURRENT_DIRECTORY.resolve(fileName); |
| 150 | + if (Files.isRegularFile(font)) |
| 151 | + zip.putFile(font, ".hmcl/" + fileName); |
139 | 152 | } |
140 | 153 |
|
141 | 154 | zip.putFile(launcherJar, launcherJar.getFileName().toString()); |
|
0 commit comments