From 273888c70b5fcfb1030eff4529e9869eae12e72a Mon Sep 17 00:00:00 2001 From: titusfortner Date: Mon, 18 Sep 2023 16:11:38 -0700 Subject: [PATCH] [dotnet] do not check OSPlatform if setting environment variable --- dotnet/src/webdriver/SeleniumManager.cs | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/dotnet/src/webdriver/SeleniumManager.cs b/dotnet/src/webdriver/SeleniumManager.cs index fd151e48e9f40..dfb530482bca5 100644 --- a/dotnet/src/webdriver/SeleniumManager.cs +++ b/dotnet/src/webdriver/SeleniumManager.cs @@ -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))