diff --git a/Torch.Server/TorchConfig.cs b/Torch.Server/TorchConfig.cs index 2c2d635..8a7d322 100644 --- a/Torch.Server/TorchConfig.cs +++ b/Torch.Server/TorchConfig.cs @@ -21,9 +21,33 @@ namespace Torch.Server [Arg("instancename", "The name of the Torch instance.")] public string InstanceName { get; set; } + + private string _instancePath; + /// [Arg("instancepath", "Server data folder where saves and mods are stored.")] - public string InstancePath { get; set; } + public string InstancePath + { + get => _instancePath; + set + { + try + { + if(value.Contains("\"")) + throw new InvalidOperationException(); + + var s = Path.GetFullPath(value); + Console.WriteLine(s); //prevent compiler opitmization - just in case + } + catch (Exception ex) + { + _log.Error(ex, "Invalid path assigned to InstancePath! Please report this immediately!"); + throw; + } + + _instancePath = value; + } + } /// [XmlIgnore, Arg("noupdate", "Disable automatically downloading game and plugin updates.")]