From 70abe02d9760a889d82a12e98da379ecbb1c7539 Mon Sep 17 00:00:00 2001 From: Bartosz Skrzypczak Date: Fri, 7 Jan 2022 23:20:59 +0100 Subject: [PATCH] Fix 1.18.x on windows --- build.gradle | 2 +- src/main/java/ofdev/modlauncher/OFDevRetransformer.java | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 13e905d..9f3c074 100644 --- a/build.gradle +++ b/build.gradle @@ -12,7 +12,7 @@ buildscript { apply plugin: 'com.github.johnrengelman.shadow' apply plugin: 'java' -version = "2.6.4" +version = "2.6.5" group = "ofdev" // http://maven.apache.org/guides/mini/guide-naming-conventions.html archivesBaseName = "aa_do_not_rename_OptiFineDevTweaker" diff --git a/src/main/java/ofdev/modlauncher/OFDevRetransformer.java b/src/main/java/ofdev/modlauncher/OFDevRetransformer.java index 3466c27..832faf8 100644 --- a/src/main/java/ofdev/modlauncher/OFDevRetransformer.java +++ b/src/main/java/ofdev/modlauncher/OFDevRetransformer.java @@ -92,6 +92,9 @@ private static Collection findOptiFineClasses(IEnvironment env @SuppressWarnings("unchecked") Optional location = (Optional) locationMethod.invoke(reference); String path = location.orElseThrow(() -> new IllegalStateException("No module location!")).getPath(); optifineFile = path.substring(0, path.lastIndexOf('#')); + if (optifineFile.startsWith("/")) { + optifineFile = optifineFile.substring(1); + } optifineFile = Paths.get(optifineFile).getFileName().toString(); } catch (ReflectiveOperationException ex) { throw new IllegalStateException(ex);