From 46c78dad3d2d30a65499a1e68758f177020e04cb Mon Sep 17 00:00:00 2001 From: Anatolij Vasilev Date: Sat, 21 Oct 2023 11:51:40 +0200 Subject: [PATCH] fixed path yet again --- SoG_SGreader.Test/DataReaderTests.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/SoG_SGreader.Test/DataReaderTests.cs b/SoG_SGreader.Test/DataReaderTests.cs index a08aef8..aeeb938 100644 --- a/SoG_SGreader.Test/DataReaderTests.cs +++ b/SoG_SGreader.Test/DataReaderTests.cs @@ -15,8 +15,15 @@ private static Player GetSaveGame(int saveGameNumber) { DataReader dataReader = new DataReader(); var txtConsoleMock = new Mock().Object; - - string projectDirectory = Environment.GetEnvironmentVariable("GITHUB_WORKSPACE") ?? Directory.GetParent(AppDomain.CurrentDomain.BaseDirectory).Parent.Parent.FullName; + + string projectDirectory = Directory.GetParent(AppDomain.CurrentDomain.BaseDirectory).Parent.Parent.FullName; + + // Exception for GitHub Actions Test Runner + if (Environment.GetEnvironmentVariable("GITHUB_WORKSPACE") != null) + { + projectDirectory = Directory.GetParent(Environment.GetEnvironmentVariable("GITHUB_WORKSPACE")).FullName; + } + string filePath = Path.Combine(projectDirectory, "..", "SoG_SGreader.Test", "SaveGames", saveGameNumber + ".cha"); return dataReader.ReadFromFile(filePath, txtConsoleMock);