Browse Source

Explicitly call Path.normalize on Platform paths, fixing #212

Signed-off-by: Max <maxh2709@gmail.com>
Max 3 years ago
parent
commit
4d75441531

+ 3 - 3
common/src/main/java/me/shedaniel/architectury/platform/Platform.java

@@ -81,7 +81,7 @@ public final class Platform {
     /**
      * Gets the root directory for the current instance of Minecraft.
      * <p>
-     * The returned path is guaranteed to be <b>absolute</b>.
+     * The returned path is guaranteed to be <b>absolute</b> and <b>normalized</b>.
      */
     @ExpectPlatform
     public static Path getGameFolder() {
@@ -91,7 +91,7 @@ public final class Platform {
     /**
      * Gets the main <code>config</code> folder for the current instance of Minecraft.
      * <p>
-     * The returned path is guaranteed to be <b>absolute</b>.
+     * The returned path is guaranteed to be <b>absolute</b> and <b>normalized</b>.
      */
     @ExpectPlatform
     public static Path getConfigFolder() {
@@ -101,7 +101,7 @@ public final class Platform {
     /**
      * Gets the <code>mods</code> folder of the current instance of Minecraft.
      * <p>
-     * The returned path is guaranteed to be <b>absolute</b>.
+     * The returned path is guaranteed to be <b>absolute</b> and <b>normalized</b>.
      */
     @ExpectPlatform
     public static Path getModsFolder() {

+ 8 - 2
fabric/src/main/java/me/shedaniel/architectury/platform/fabric/PlatformImpl.java

@@ -42,11 +42,17 @@ public class PlatformImpl {
     private static final Map<String, Mod> mods = new ConcurrentHashMap<>();
     
     public static Path getGameFolder() {
-        return FabricLoader.getInstance().getGameDir().toAbsolutePath();
+        return FabricLoader.getInstance()
+                .getGameDir()
+                .toAbsolutePath()
+                .normalize();
     }
     
     public static Path getConfigFolder() {
-        return FabricLoader.getInstance().getConfigDir().toAbsolutePath();
+        return FabricLoader.getInstance()
+                .getConfigDir()
+                .toAbsolutePath()
+                .normalize();
     }
     
     public static Path getModsFolder() {