fix: export modpack
This commit is contained in:
@@ -36,6 +36,7 @@ import org.jackhuang.hmcl.util.platform.OperatingSystem;
|
|||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.lang.management.ManagementFactory;
|
import java.lang.management.ManagementFactory;
|
||||||
import java.net.*;
|
import java.net.*;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
@@ -160,10 +161,15 @@ public final class Launcher extends Application {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
File jarFile = new File(Launcher.class.getProtectionDomain().getCodeSource().getLocation().getPath());
|
try {
|
||||||
String ext = FileUtils.getExtension(jarFile);
|
File jarFile = new File(URLDecoder.decode(Launcher.class.getProtectionDomain().getCodeSource().getLocation().getPath(), "UTF-8"));
|
||||||
if ("jar".equals(ext) || "exe".equals(ext))
|
String ext = FileUtils.getExtension(jarFile);
|
||||||
result.add(jarFile);
|
if ("jar".equals(ext) || "exe".equals(ext))
|
||||||
|
result.add(jarFile);
|
||||||
|
} catch (UnsupportedEncodingException e) {
|
||||||
|
LOG.log(Level.WARNING, "Failed to decode jar path", e);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (result.isEmpty())
|
if (result.isEmpty())
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ public final class ModpackFileSelectionPage extends StackPane implements WizardP
|
|||||||
|
|
||||||
private void getFilesNeeded(CheckBoxTreeItem<String> node, String basePath, List<String> list) {
|
private void getFilesNeeded(CheckBoxTreeItem<String> node, String basePath, List<String> list) {
|
||||||
if (node == null) return;
|
if (node == null) return;
|
||||||
if (node.isSelected()) {
|
if (node.isSelected() || node.isIndeterminate()) {
|
||||||
if (basePath.length() > "minecraft/".length())
|
if (basePath.length() > "minecraft/".length())
|
||||||
list.add(StringUtils.substringAfter(basePath, "minecraft/"));
|
list.add(StringUtils.substringAfter(basePath, "minecraft/"));
|
||||||
for (TreeItem<String> child : node.getChildren()) {
|
for (TreeItem<String> child : node.getChildren()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user