fix regression issue with log paths oops

This commit is contained in:
RaidMax 2020-04-13 18:15:46 -05:00
parent be8041b868
commit fca47cbce0
2 changed files with 17 additions and 3 deletions

View File

@ -946,7 +946,7 @@ namespace IW4MAdmin
try
{
var website = await this.GetDvarAsync<string>("_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;
}

View File

@ -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);
}
}
}