Compare commits

...

3 commits

Author SHA1 Message Date
Gravit'a
76f8b4602c [FIX] JAVA_HOME override 2023-04-15 17:40:34 +07:00
Gravit'a
fc7f96d536 [FIX] launcher-pack in Windows 2023-04-15 13:59:32 +07:00
Gravit'a
4ed687087f [FIX] LauncherGuard default config 2023-04-15 13:51:33 +07:00
6 changed files with 15 additions and 21 deletions

View file

@ -45,7 +45,7 @@ public Path process(Path inputFile) throws IOException {
throw new RuntimeException(ex); throw new RuntimeException(ex);
} }
})) { })) {
var map = stream.collect(Collectors.toMap(k -> server.launcherPack.relativize(k).toString(), (v) -> v)); var map = stream.collect(Collectors.toMap(k -> server.launcherPack.relativize(k).toString().replace("\\", "/"), (v) -> v));
server.launcherBinary.files.putAll(map); server.launcherBinary.files.putAll(map);
} }
UnpackHelper.unpack(IOHelper.getResourceURL("Launcher.jar"), result); UnpackHelper.unpack(IOHelper.getResourceURL("Launcher.jar"), result);

View file

@ -119,17 +119,6 @@ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IO
ModuleEntity entity = new ModuleEntity(); ModuleEntity entity = new ModuleEntity();
entity.path = file; entity.path = file;
entity.moduleMainClass = mainClass; entity.moduleMainClass = mainClass;
try {
Class<? extends LauncherModule> mainClazz = (Class<? extends LauncherModule>) classLoader.loadClass(entity.moduleMainClass);
entity.checkResult = server.modulesManager.checkModuleClass(mainClazz);
} catch (Throwable e) {
if (e instanceof ClassNotFoundException || e instanceof NoClassDefFoundError) {
logger.error("Module-MainClass in module {} incorrect", file.toString());
} else {
logger.error(e);
}
return super.visitFile(file, attrs);
}
entity.moduleConfigClass = attributes.getValue("Module-Config-Class"); entity.moduleConfigClass = attributes.getValue("Module-Config-Class");
if (entity.moduleConfigClass != null) { if (entity.moduleConfigClass != null) {
entity.moduleConfigName = attributes.getValue("Module-Config-Name"); entity.moduleConfigName = attributes.getValue("Module-Config-Name");

View file

@ -141,8 +141,12 @@ public static void main(String[] arguments) throws IOException, InterruptedExcep
if (customJvmOptions != null) { if (customJvmOptions != null) {
args.addAll(customJvmOptions); args.addAll(customJvmOptions);
} }
if(context.useLegacyClasspathProperty) {
args.add(String.format("-Djava.class.path=%s", String.join(IOHelper.PLATFORM_SEPARATOR, context.classpath)));
} else {
args.add("-cp"); args.add("-cp");
args.add(String.join(IOHelper.PLATFORM_SEPARATOR, context.classpath)); args.add(String.join(IOHelper.PLATFORM_SEPARATOR, context.classpath));
}
args.add(context.mainClass); args.add(context.mainClass);
args.addAll(context.clientArgs); args.addAll(context.clientArgs);
LogHelper.debug("Commandline: " + args); LogHelper.debug("Commandline: " + args);
@ -170,6 +174,7 @@ public static class ClientLauncherWrapperContext {
public Path executePath; public Path executePath;
public String mainClass; public String mainClass;
public int memoryLimit; public int memoryLimit;
public boolean useLegacyClasspathProperty;
public ProcessBuilder processBuilder; public ProcessBuilder processBuilder;
public List<String> args = new ArrayList<>(8); public List<String> args = new ArrayList<>(8);
public Map<String, String> jvmProperties = new HashMap<>(); public Map<String, String> jvmProperties = new HashMap<>();

View file

@ -113,7 +113,7 @@ public static Path getGuardDir() {
} }
public static Path getGuardDir(JVMHelper.ARCH arch, JVMHelper.OS os) { public static Path getGuardDir(JVMHelper.ARCH arch, JVMHelper.OS os) {
Path dir = getGuardDir().resolve(makeSpecialGuardDirName(arch, os)); Path dir = getGuardDir().resolve(Launcher.makeSpecialGuardDirName(arch, os));
try { try {
IOHelper.createParentDirs(dir); IOHelper.createParentDirs(dir);
} catch (Throwable e) { } catch (Throwable e) {
@ -123,11 +123,6 @@ public static Path getGuardDir(JVMHelper.ARCH arch, JVMHelper.OS os) {
} }
public static String makeSpecialGuardDirName(JVMHelper.ARCH arch, JVMHelper.OS os) {
return String.format("%s-%s", arch.name, os.name);
}
public static Path getLegacyLauncherDir(String projectname) { public static Path getLegacyLauncherDir(String projectname) {
return IOHelper.HOME_DIR.resolve(projectname); return IOHelper.HOME_DIR.resolve(projectname);
} }

View file

@ -4,6 +4,7 @@
import pro.gravit.launcher.profiles.ClientProfile; import pro.gravit.launcher.profiles.ClientProfile;
import pro.gravit.launcher.serialize.HInput; import pro.gravit.launcher.serialize.HInput;
import pro.gravit.utils.helper.IOHelper; import pro.gravit.utils.helper.IOHelper;
import pro.gravit.utils.helper.JVMHelper;
import pro.gravit.utils.helper.LogHelper; import pro.gravit.utils.helper.LogHelper;
import pro.gravit.utils.helper.SecurityHelper; import pro.gravit.utils.helper.SecurityHelper;
@ -122,4 +123,8 @@ public static void applyLauncherEnv(LauncherConfig.LauncherEnvironment env) {
break; break;
} }
} }
public static String makeSpecialGuardDirName(JVMHelper.ARCH arch, JVMHelper.OS os) {
return String.format("%s-%s", arch.name, os.name);
}
} }

@ -1 +1 @@
Subproject commit 9be16b2bc7047659577f976b5f95a71469d8a735 Subproject commit 8adf9de6efe47bd820f756184f2a184e1d677dd8