diff --git a/TGServerService/DeprecatedInstanceConfig.cs b/TGServerService/DeprecatedInstanceConfig.cs
index 0c201ae057..9eff86cc04 100644
--- a/TGServerService/DeprecatedInstanceConfig.cs
+++ b/TGServerService/DeprecatedInstanceConfig.cs
@@ -20,7 +20,7 @@ namespace TGServerService
public static IInstanceConfig CreateFromNETSettings()
{
var Config = Properties.Settings.Default;
- var result = new DeprecatedInstanceConfig(LoadPreviousNetPropertyOrDefault("ServerDirectory", "C:\\tgstation-server-3"));
+ var result = new DeprecatedInstanceConfig(Program.NormalizePath(LoadPreviousNetPropertyOrDefault("ServerDirectory", "C:\\tgstation-server-3")));
// using nameof for sanity where possible
result.ProjectName = LoadPreviousNetPropertyOrDefault(nameof(ProjectName), result.ProjectName);
result.Port = LoadPreviousNetPropertyOrDefault("ServerPort", result.Port);
diff --git a/TGServerService/Program.cs b/TGServerService/Program.cs
index a9c208a629..5184c9f194 100644
--- a/TGServerService/Program.cs
+++ b/TGServerService/Program.cs
@@ -175,5 +175,17 @@ namespace TGServerService
{
return input.Replace("%", "%25").Replace("=", "%3d").Replace(";", "%3b").Replace("&", "%26").Replace("+", "%2b");
}
+
+ ///
+ /// Normalizes different versions of a path
+ ///
+ /// The path to normalize
+ /// The normalized path
+ public static string NormalizePath(string path)
+ {
+ return Path.GetFullPath(new Uri(path).LocalPath)
+ .TrimEnd(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar)
+ .ToUpperInvariant();
+ }
}
}
diff --git a/TGServerService/Service.cs b/TGServerService/Service.cs
index c4835b0a66..a47c89511b 100644
--- a/TGServerService/Service.cs
+++ b/TGServerService/Service.cs
@@ -471,6 +471,7 @@ namespace TGServerService
///
public string CreateInstance(string Name, string path)
{
+ path = Program.NormalizePath(path);
var res = CheckInstanceName(Name);
if (res != null)
return res;
@@ -529,6 +530,7 @@ namespace TGServerService
///
public string ImportInstance(string path)
{
+ path = Program.NormalizePath(path);
var Config = Properties.Settings.Default;
lock (this)
{