Architectury API (Fabric/Forge/NeoForge)

Architectury API (Fabric/Forge/NeoForge)

158M Downloads

Platform.getGameFolder() returns a different path on a Fabric Server than it does the Fabric Client and Forge Client & Server.

Vaelzan opened this issue ยท 1 comments

commented

This is using Architectury 3.7.22, verified with the latest Architectury Template. It has the impact of causing KubeJS to fail when running JsonIO.read(...) on a server, which is breaking a number of scripts that I've recently written.

When running Platform.getGameFolder() on a Fabric server, an additional trailing \. is returned at the end of the path, whereas with the Fabric client, and both Forge client & server this isn't the case. This can be fixed by adding .normalize() to the end of this line:

return FabricLoader.getInstance().getGameDir().toAbsolutePath();
- that'd ensure that there's consistent output across platforms (the same normalize method could be used in KubeJS to fix my issue, but it makes more sense to me for Architectury to include the fix just in case other mods make the same assumption about the output being consistent).

My tests:
Fabric Client: D:\Gamedev\Projects\2022\Minecraft\architectury-testing\fabric\run
Fabric Server: D:\Gamedev\Projects\2022\Minecraft\architectury-testing\fabric\run\.
Forge Client: D:\Gamedev\Projects\2022\Minecraft\architectury-testing\forge\run
Forge Server: D:\Gamedev\Projects\2022\Minecraft\architectury-testing\forge\run

commented

Thanks for the prompt fix!