From e966d40ae24ee91df72697b22cb3ddb43f5128d2 Mon Sep 17 00:00:00 2001 From: coolGi Date: Tue, 3 Oct 2023 22:48:04 +1030 Subject: [PATCH] Fixed jar reference with spaces in path --- .../distanthorizons/core/jar/JarUtils.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/com/seibel/distanthorizons/core/jar/JarUtils.java b/core/src/main/java/com/seibel/distanthorizons/core/jar/JarUtils.java index 0d4cc63cc..5ddfb9b06 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/jar/JarUtils.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/jar/JarUtils.java @@ -34,7 +34,21 @@ import java.util.Objects; */ public class JarUtils { - public static final File jarFile = new File(JarUtils.class.getProtectionDomain().getCodeSource().getLocation().getPath()); + public static File jarFile = null; + + static { + try { + jarFile = new File(JarUtils.class.getProtectionDomain().getCodeSource().getLocation().toURI()); // Always safe + } + catch (Exception e) + { + e.printStackTrace(); + } + } + + public static void main(String[] args) { + System.out.println(jarFile); + } /**