Skip to content

Commit b0e544b

Browse files
committed
Avoid using relative path for WpfApplication
1 parent f38deb9 commit b0e544b

1 file changed

Lines changed: 17 additions & 2 deletions

File tree

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,24 @@
11
using System.IO;
2+
using System.Linq;
23

34
namespace FlaUI.WebDriver.UITests.TestUtil
45
{
56
public static class TestApplication
67
{
7-
public static string FullPath => Path.GetFullPath("..\\..\\..\\..\\TestApplications\\WpfApplication\\bin\\Release\\WpfApplication.exe");
8-
}
8+
9+
private static readonly string _currentDirectory = Directory.GetCurrentDirectory();
10+
private static readonly string _solutionDirectory = FindSolutionDirectory(_currentDirectory);
11+
12+
private static string FindSolutionDirectory(string currentDirectory)
13+
{
14+
while (!Directory.GetFiles(currentDirectory, "*.sln").Any())
15+
{
16+
currentDirectory = Directory.GetParent(currentDirectory).FullName;
17+
}
18+
return currentDirectory;
19+
}
20+
21+
public static string FullPath => Path.Combine(_solutionDirectory, "TestApplications", "WpfApplication", "bin", "Release", "WpfApplication.exe");
22+
}
23+
924
}

0 commit comments

Comments
 (0)