fix world path being truncated if missing trailing slash
This commit is contained in:
@@ -134,7 +134,7 @@ namespace Torch.Server.Managers
|
|||||||
worldPath = DedicatedConfig.Worlds.First().WorldPath;
|
worldPath = DedicatedConfig.Worlds.First().WorldPath;
|
||||||
else
|
else
|
||||||
// make sure we won't end up with a file path when we expect it to be a directory
|
// 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);
|
worldPath = worldPath.EndsWith(".sbc") ? Path.GetDirectoryName(worldPath) : worldPath;
|
||||||
|
|
||||||
SelectWorld(worldPath, false);
|
SelectWorld(worldPath, false);
|
||||||
|
|
||||||
@@ -235,7 +235,7 @@ namespace Torch.Server.Managers
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
MyObjectBuilderSerializer.DeserializeXML(sandboxPath, out MyObjectBuilder_Checkpoint checkpoint, out ulong sizeInBytes);
|
MyObjectBuilderSerializerKeen.DeserializeXML(sandboxPath, out MyObjectBuilder_Checkpoint checkpoint, out ulong sizeInBytes);
|
||||||
if (checkpoint == null)
|
if (checkpoint == null)
|
||||||
{
|
{
|
||||||
Log.Error($"Failed to load {DedicatedConfig.LoadWorld}, checkpoint null ({sizeInBytes} bytes, instance {Torch.Config.InstancePath})");
|
Log.Error($"Failed to load {DedicatedConfig.LoadWorld}, checkpoint null ({sizeInBytes} bytes, instance {Torch.Config.InstancePath})");
|
||||||
@@ -368,14 +368,14 @@ namespace Torch.Server.Managers
|
|||||||
|
|
||||||
public void LoadSandbox()
|
public void LoadSandbox()
|
||||||
{
|
{
|
||||||
if (!MyObjectBuilderSerializer.DeserializeXML(_checkpointPath, out MyObjectBuilder_Checkpoint checkpoint))
|
if (!MyObjectBuilderSerializerKeen.DeserializeXML(_checkpointPath, out MyObjectBuilder_Checkpoint checkpoint))
|
||||||
throw new SerializationException("Error reading checkpoint, see keen log for details");
|
throw new SerializationException("Error reading checkpoint, see keen log for details");
|
||||||
Checkpoint = new CheckpointViewModel(checkpoint);
|
Checkpoint = new CheckpointViewModel(checkpoint);
|
||||||
|
|
||||||
// migrate old saves
|
// migrate old saves
|
||||||
if (File.Exists(_worldConfigPath))
|
if (File.Exists(_worldConfigPath))
|
||||||
{
|
{
|
||||||
if (!MyObjectBuilderSerializer.DeserializeXML(_worldConfigPath, out MyObjectBuilder_WorldConfiguration worldConfig))
|
if (!MyObjectBuilderSerializerKeen.DeserializeXML(_worldConfigPath, out MyObjectBuilder_WorldConfiguration worldConfig))
|
||||||
throw new SerializationException("Error reading settings, see keen log for details");
|
throw new SerializationException("Error reading settings, see keen log for details");
|
||||||
WorldConfiguration = new WorldConfigurationViewModel(worldConfig);
|
WorldConfiguration = new WorldConfigurationViewModel(worldConfig);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user