Skip to content

Commit 573eee0

Browse files
committed
[dotnet] skip using Runfiles when not using Bazel
1 parent 35e7007 commit 573eee0

File tree

2 files changed

+20
-4
lines changed

2 files changed

+20
-4
lines changed

dotnet/test/common/Environment/EnvironmentManager.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,16 @@ public class EnvironmentManager
2222

2323
private EnvironmentManager()
2424
{
25-
var runfiles = Runfiles.Create();
26-
var dataFilePath = runfiles.Rlocation("selenium/dotnet/test/common/appconfig.json");
25+
string dataFilePath;
26+
try
27+
{
28+
var runfiles = Runfiles.Create();
29+
dataFilePath = runfiles.Rlocation("selenium/dotnet/test/common/appconfig.json");
30+
}
31+
catch (FileNotFoundException)
32+
{
33+
dataFilePath = "appconfig.json";
34+
}
2735
string currentDirectory = this.CurrentDirectory;
2836

2937
string content = File.ReadAllText(dataFilePath);

dotnet/test/common/Environment/TestWebServer.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,16 @@ public void Start()
3636
{
3737
if (webserverProcess == null || webserverProcess.HasExited)
3838
{
39-
var runfiles = Runfiles.Create();
40-
standaloneTestJar = runfiles.Rlocation(standaloneTestJar);
39+
try
40+
{
41+
var runfiles = Runfiles.Create();
42+
standaloneTestJar = runfiles.Rlocation(standaloneTestJar);
43+
}
44+
catch (FileNotFoundException)
45+
{
46+
var baseDirectory = AppContext.BaseDirectory;
47+
standaloneTestJar = Path.Combine(baseDirectory, "../../../../../../bazel-bin/java/test/org/openqa/selenium/environment/appserver");
48+
}
4149

4250
Console.Write("Standalone jar is " + standaloneTestJar);
4351

0 commit comments

Comments
 (0)