Compare commits

..

No commits in common. "76f8b4602c0631a11cc77a87130bbe3b698680af" and "95da394a5d956aa6ae402deb48b6f46322548f28" have entirely different histories.

6 changed files with 21 additions and 15 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().replace("\\", "/"), (v) -> v)); var map = stream.collect(Collectors.toMap(k -> server.launcherPack.relativize(k).toString(), (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,6 +119,17 @@ 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,12 +141,8 @@ 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);
@ -174,7 +170,6 @@ 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(Launcher.makeSpecialGuardDirName(arch, os)); Path dir = getGuardDir().resolve(makeSpecialGuardDirName(arch, os));
try { try {
IOHelper.createParentDirs(dir); IOHelper.createParentDirs(dir);
} catch (Throwable e) { } catch (Throwable e) {
@ -123,6 +123,11 @@ 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,7 +4,6 @@
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;
@ -123,8 +122,4 @@ 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 8adf9de6efe47bd820f756184f2a184e1d677dd8 Subproject commit 9be16b2bc7047659577f976b5f95a71469d8a735