From 9b9d8b7241ccc63cfdd930e5dc60cc73ce6cc3b1 Mon Sep 17 00:00:00 2001 From: zznty <94796179+zznty@users.noreply.github.com> Date: Sun, 25 Aug 2024 16:53:19 +0700 Subject: [PATCH] fix world checkpoint loading --- Torch.Server/Managers/InstanceManager.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Torch.Server/Managers/InstanceManager.cs b/Torch.Server/Managers/InstanceManager.cs index d6141c6..a4e4a9e 100644 --- a/Torch.Server/Managers/InstanceManager.cs +++ b/Torch.Server/Managers/InstanceManager.cs @@ -128,7 +128,15 @@ namespace Torch.Server.Managers return; } - SelectWorld(DedicatedConfig.LoadWorld ?? DedicatedConfig.Worlds.First().WorldPath, false); + var worldPath = DedicatedConfig.LoadWorld; + + if (worldPath == null) + worldPath = DedicatedConfig.Worlds.First().WorldPath; + else + // make sure we won't end up with a file path when we expect it to be a directory + worldPath = Path.EndsInDirectorySeparator(worldPath) ? worldPath : Path.GetDirectoryName(worldPath); + + SelectWorld(worldPath, false); _instanceLoaded?.Invoke(DedicatedConfig); }