From 2e67b368c1b5afe7e73997449b566e938181e304 Mon Sep 17 00:00:00 2001 From: PumpkinXD <1042588515@qq.com> Date: Fri, 18 Nov 2022 12:11:12 +0800 Subject: [PATCH] fixing a problem caused by the essentiall mod on Windows(see screenshot in commit comment) --- build.gradle | 2 +- .../mixinGuiScreenResourcePacks_openFolderFix.java | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index 0aca505..2ef451d 100644 --- a/build.gradle +++ b/build.gradle @@ -25,7 +25,7 @@ compileJava { sourceCompatibility = targetCompatibility = 8 } -version= "0.1.1145141919810" +version= "0.2.0" group= "io.github.pumpkinxd.linuxlegacymcurlfix" minecraft { diff --git a/src/main/java/io/github/pumpkinxd/linuxlegacymcurlfix/mixins/bugfixes/mixinGuiScreenResourcePacks_openFolderFix.java b/src/main/java/io/github/pumpkinxd/linuxlegacymcurlfix/mixins/bugfixes/mixinGuiScreenResourcePacks_openFolderFix.java index 236a930..dbf23c9 100644 --- a/src/main/java/io/github/pumpkinxd/linuxlegacymcurlfix/mixins/bugfixes/mixinGuiScreenResourcePacks_openFolderFix.java +++ b/src/main/java/io/github/pumpkinxd/linuxlegacymcurlfix/mixins/bugfixes/mixinGuiScreenResourcePacks_openFolderFix.java @@ -4,6 +4,7 @@ import net.minecraft.client.gui.GuiScreenResourcePacks; import net.minecraft.client.resources.ResourcePackRepository; import net.minecraft.util.Util; +import net.minecraftforge.fml.common.Loader; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.lwjgl.Sys; @@ -66,8 +67,14 @@ public void fixOpenResFolder(CallbackInfo ci){ } else { if (SystemUtils.IS_OS_WINDOWS) { - String s1 = String.format("cmd.exe /C start \"Open file\" \"%s\"", new Object[] {repopath}); - + String s1; + if(Loader.isModLoaded("essential")&&repopath.charAt(0)=='\\') + { + s1 = String.format("cmd.exe /C start \"Open file\" \"%s\"", new Object[] {repopath.substring(1)}); + } + else { + s1 = String.format("cmd.exe /C start \"Open file\" \"%s\"", new Object[]{repopath}); + } try { Runtime.getRuntime().exec(s1);