Add debug info to InstancePath setter to track down a stupid bug

This commit is contained in:
Brant Martin
2019-06-22 23:36:57 -04:00
parent 7b2b0edbdf
commit d8ac3b2353

View File

@@ -21,9 +21,33 @@ namespace Torch.Server
[Arg("instancename", "The name of the Torch instance.")] [Arg("instancename", "The name of the Torch instance.")]
public string InstanceName { get; set; } public string InstanceName { get; set; }
private string _instancePath;
/// <inheritdoc /> /// <inheritdoc />
[Arg("instancepath", "Server data folder where saves and mods are stored.")] [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;
}
}
/// <inheritdoc /> /// <inheritdoc />
[XmlIgnore, Arg("noupdate", "Disable automatically downloading game and plugin updates.")] [XmlIgnore, Arg("noupdate", "Disable automatically downloading game and plugin updates.")]