From d8ac3b23533e8b7bcc7bec098adc20f2e3b5e964 Mon Sep 17 00:00:00 2001 From: Brant Martin Date: Sat, 22 Jun 2019 23:36:57 -0400 Subject: [PATCH] Add debug info to InstancePath setter to track down a stupid bug --- Torch.Server/TorchConfig.cs | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) 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.")]