Skip to content

Commit 585fbaa

Browse files
committed
Fix issues #2 #3 #4
1 parent a48ba16 commit 585fbaa

File tree

5 files changed

+18
-17
lines changed

5 files changed

+18
-17
lines changed

WebDriverManager/BrowserManagers/ChromeDriverManager.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ public ChromeDriverManager(string version)
6262

6363
public void Init()
6464
{
65-
_config.Destination = Path.Combine(Directory.GetCurrentDirectory(), WebDriverManagerConfig.DefaultDestinationFolder);
65+
_config.Destination = Path.Combine(Directory.GetCurrentDirectory(),
66+
WebDriverManagerConfig.DefaultDestinationFolder);
6667
Log?.Debug($"Use default chrome driver destination path: '{_config.Destination}'");
6768
Base();
6869
}

WebDriverManager/Helpers/WebDriverManager.cs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
namespace WebDriverManager.Helpers
1+
using Microsoft.Win32;
2+
3+
namespace WebDriverManager.Helpers
24
{
35
using NLog;
46
using System;
@@ -173,7 +175,7 @@ public static void AddEnvironmentVariable(string variable)
173175
{
174176
var variableValue = Environment.GetEnvironmentVariable(variable);
175177
if (variableValue == null || !variableValue.Equals(DestinationFolder))
176-
Environment.SetEnvironmentVariable(variable, DestinationFolder, EnvironmentVariableTarget.Machine);
178+
Environment.SetEnvironmentVariable(variable, DestinationFolder, EnvironmentVariableTarget.Process);
177179
}
178180
catch (Exception ex)
179181
{
@@ -187,20 +189,18 @@ public static void AddEnvironmentVariable(string variable)
187189
/// Update browser driver environment variable if it's already exist and different from current
188190
/// </summary>
189191
/// <param name="variable">Environment variable</param>
190-
/// <param name="extendPath">Extend PATH variable with driver variable</param>
191-
public static void UpdatePath(string variable, bool extendPath = false)
192+
public static void UpdatePath(string variable)
192193
{
193194
try
194195
{
195-
if (!extendPath) return;
196196
const string name = "PATH";
197-
var pathVariable = Environment.GetEnvironmentVariable(name);
198-
var newPathVariable = pathVariable +
199-
(pathVariable != null && pathVariable.EndsWith(";") ? string.Empty : ";") +
200-
$@"%{variable}%";
201-
if (pathVariable != null && !pathVariable.Contains(DestinationFolder) &&
202-
!pathVariable.Contains(variable))
203-
Environment.SetEnvironmentVariable(newPathVariable, name, EnvironmentVariableTarget.Machine);
197+
const string keyName = @"SYSTEM\CurrentControlSet\Control\Session Manager\Environment";
198+
var pathVariable = (string) Registry.LocalMachine.CreateSubKey(keyName)?
199+
.GetValue(name, string.Empty, RegistryValueOptions.DoNotExpandEnvironmentNames);
200+
if (pathVariable == null) throw new Exception($"Can't get {name} variable");
201+
var newPathVariable = $"%{variable}%;{pathVariable}";
202+
if (!pathVariable.Contains(variable))
203+
Environment.SetEnvironmentVariable(name, newPathVariable, EnvironmentVariableTarget.Process);
204204
}
205205
catch (Exception ex)
206206
{

WebDriverManager/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,5 @@
3939
// by using the '*' as shown below:
4040
//[assembly: AssemblyVersion("1.0.*")]
4141

42-
[assembly: AssemblyVersion("1.2.3")]
43-
[assembly: AssemblyFileVersion("1.2.3")]
42+
[assembly: AssemblyVersion("1.3.0")]
43+
[assembly: AssemblyFileVersion("1.3.0")]

WebDriverManager/WebDriverManager.nuspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<requireLicenseAcceptance>false</requireLicenseAcceptance>
1212
<description>$description$</description>
1313
<summary>$description$</summary>
14-
<releaseNotes>Fix issue #3 and typos</releaseNotes>
14+
<releaseNotes>Fix issues #2 #3 #4</releaseNotes>
1515
<copyright>Copyright © Alexander Rosolko 2016</copyright>
1616
<tags>Selenium WebDriver ChromeDriver EdgeDriver InternetExplorerDriver MarionetteDriver OperaDriver PhantomJsDriver AppiumDriver</tags>
1717
</metadata>

qube.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
MSBuild.SonarQube.Runner.exe begin /k:"rosolko" /n:"WebDriverManager.Net" /v:"1.2.1"
1+
MSBuild.SonarQube.Runner.exe begin /k:"rosolko" /n:"WebDriverManager.Net" /v:"1.3.0"
22
msbuild /t:Rebuild
33
MSBuild.SonarQube.Runner.exe end

0 commit comments

Comments
 (0)