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

Signed-off-by: Max <maxh2709@gmail.com>
This commit is contained in:
Max
2022-02-27 15:51:09 +01:00
parent e0cbeb45ed
commit ae849d58c8
2 changed files with 11 additions and 5 deletions

View File

@@ -65,7 +65,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() {
@@ -75,7 +75,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() {
@@ -85,7 +85,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() {

View File

@@ -41,11 +41,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() {