Skip to content

Commit

Permalink
[dotnet] do not check OSPlatform if setting environment variable
Browse files Browse the repository at this point in the history
  • Loading branch information
titusfortner committed Sep 18, 2023
1 parent 0755e68 commit 273888c
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions dotnet/src/webdriver/SeleniumManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,26 +40,25 @@ static SeleniumManager()
{
var currentDirectory = AppContext.BaseDirectory;

string file = "selenium-manager";
string binary = $"selenium-manager/linux/{file}";

if (Environment.GetEnvironmentVariable("SE_MANAGER_PATH") != null)
{
binaryFullPath = Environment.GetEnvironmentVariable("SE_MANAGER_PATH");
}
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
file = "selenium-manager.exe";
binary = $"selenium-manager/windows/{file}";
binaryFullPath = Path.Combine(currentDirectory, "selenium-manager\\windows\\selenium-manager.exe");
}
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
{
binaryFullPath = Path.Combine(currentDirectory, "selenium-manager\\linux\\selenium-manager");
}
else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
binary = $"selenium-manager/macos/{file}";
binaryFullPath = Path.Combine(currentDirectory, "selenium-manager\\macos\\selenium-manager");
}

if (binaryFullPath == null)
else
{
binaryFullPath = Path.Combine(currentDirectory, binary);
throw new PlatformNotSupportedException($"Selenium Manager doesn't support your runtime platform: {RuntimeInformation.OSDescription}");
}

if (!File.Exists(binaryFullPath))
Expand Down

0 comments on commit 273888c

Please sign in to comment.