diff --git a/Application/IW4MServer.cs b/Application/IW4MServer.cs index 44b1b073d..741e0f155 100644 --- a/Application/IW4MServer.cs +++ b/Application/IW4MServer.cs @@ -946,7 +946,7 @@ namespace IW4MAdmin try { var website = await this.GetDvarAsync("_website"); - + // this occurs for games that don't give us anything back when // the dvar is not set if (string.IsNullOrWhiteSpace(website.Value)) @@ -1032,9 +1032,14 @@ namespace IW4MAdmin string logPath; string workingDirectory = basePathDirectory; + bool baseGameIsDirectory = !string.IsNullOrWhiteSpace(baseGameDirectory) && + baseGameDirectory.IndexOfAny(Utilities.DirectorySeparatorChars) != -1; + + bool baseGameIsRelative = baseGameDirectory.FixDirectoryCharacters() + .Equals(gameDirectory.FixDirectoryCharacters(), StringComparison.InvariantCultureIgnoreCase); + // we want to see if base game is provided and it 'looks' like a directory - if (!string.IsNullOrWhiteSpace(baseGameDirectory) && - baseGameDirectory.IndexOfAny(Utilities.DirectorySeparatorChars) != -1) + if (baseGameIsDirectory && !baseGameIsRelative) { workingDirectory = baseGameDirectory; } diff --git a/Tests/ApplicationTests/IW4MServerTests.cs b/Tests/ApplicationTests/IW4MServerTests.cs index 2df1ed945..b52f709de 100644 --- a/Tests/ApplicationTests/IW4MServerTests.cs +++ b/Tests/ApplicationTests/IW4MServerTests.cs @@ -59,5 +59,14 @@ namespace ApplicationTests Assert.AreEqual(expected, generated); } + + [Test] + public void Test_GenerateLogPath_RelativeBasePath() + { + string expected = "C:\\Game\\main\\folder\\log.log"; + string generated = IW4MServer.GenerateLogPath("main\\folder", "C:\\Game", "main\\folder", null, "log.log"); + + Assert.AreEqual(expected, generated); + } } }