Reland: create modpack with launcher packed in

This commit is contained in:
huanghongxun
2021-04-22 08:40:11 +08:00
parent 07d4df312d
commit e36105d937
6 changed files with 122 additions and 38 deletions

View File

@@ -30,6 +30,7 @@ import org.jackhuang.hmcl.upgrade.UpdateHandler;
import org.jackhuang.hmcl.util.CrashReporter;
import org.jackhuang.hmcl.util.Lang;
import org.jackhuang.hmcl.util.StringUtils;
import org.jackhuang.hmcl.util.io.FileUtils;
import org.jackhuang.hmcl.util.platform.OperatingSystem;
import java.awt.*;
@@ -158,6 +159,11 @@ public final class Launcher extends Application {
} catch (URISyntaxException e) {
return null;
}
} else {
File jarFile = new File(Launcher.class.getProtectionDomain().getCodeSource().getLocation().getPath());
String ext = FileUtils.getExtension(jarFile);
if ("jar".equals(ext) || "exe".equals(ext))
result.add(jarFile);
}
if (result.isEmpty())
return null;