Skip to content

Commit 03f0265

Browse files
committed
Update packages
1 parent ac4ecbf commit 03f0265

16 files changed

+131
-64
lines changed

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,3 +234,9 @@ _Pvt_Extensions
234234

235235
# FAKE - F# Make
236236
.fake/
237+
238+
# Rider
239+
.idea
240+
241+
# SonarQube
242+
.sonarqube

WebDriverManager/BrowserManagers/AppiumDriverManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public AppiumDriverManager(string version)
6363

6464
public void Init()
6565
{
66-
_config.Destication = Path.Combine(Directory.GetCurrentDirectory(), _config.DefaultDestinationFolder);
66+
_config.Destication = Path.Combine(Directory.GetCurrentDirectory(), WebDriverManagerConfig.DefaultDestinationFolder);
6767
Base();
6868
}
6969

WebDriverManager/BrowserManagers/ChromeDriverManager.cs

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

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

WebDriverManager/BrowserManagers/EdgeDriverManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public EdgeDriverManager()
7373

7474
public void Init()
7575
{
76-
_config.Destication = Path.Combine(Directory.GetCurrentDirectory(), _config.DefaultDestinationFolder);
76+
_config.Destication = Path.Combine(Directory.GetCurrentDirectory(), WebDriverManagerConfig.DefaultDestinationFolder);
7777
Base();
7878
}
7979

WebDriverManager/BrowserManagers/InternetExplorerDriverManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ private void SetArchitecture(Architecture architecture)
113113

114114
public void Init()
115115
{
116-
_config.Destication = Path.Combine(Directory.GetCurrentDirectory(), _config.DefaultDestinationFolder);
116+
_config.Destication = Path.Combine(Directory.GetCurrentDirectory(), WebDriverManagerConfig.DefaultDestinationFolder);
117117
Base();
118118
}
119119

WebDriverManager/BrowserManagers/MarionetteDriverManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public MarionetteDriverManager(string version)
5757

5858
public void Init()
5959
{
60-
_config.Destication = Path.Combine(Directory.GetCurrentDirectory(), _config.DefaultDestinationFolder);
60+
_config.Destication = Path.Combine(Directory.GetCurrentDirectory(), WebDriverManagerConfig.DefaultDestinationFolder);
6161
Base();
6262
}
6363

WebDriverManager/BrowserManagers/OperaDriverManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ private void SetArchitecture(Architecture architecture)
8888

8989
public void Init()
9090
{
91-
_config.Destication = Path.Combine(Directory.GetCurrentDirectory(), _config.DefaultDestinationFolder);
91+
_config.Destication = Path.Combine(Directory.GetCurrentDirectory(), WebDriverManagerConfig.DefaultDestinationFolder);
9292
Base();
9393
}
9494

WebDriverManager/BrowserManagers/PhantomJsDriverManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public PhantomJsDriverManager(string version)
5858

5959
public void Init()
6060
{
61-
_config.Destication = Path.Combine(Directory.GetCurrentDirectory(), _config.DefaultDestinationFolder);
61+
_config.Destication = Path.Combine(Directory.GetCurrentDirectory(), WebDriverManagerConfig.DefaultDestinationFolder);
6262
Base();
6363
}
6464

WebDriverManager/Helpers/WebDriverManager.cs

Lines changed: 30 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -187,16 +187,20 @@ public static void AddEnvironmentVariable(string variable)
187187
/// Update browser driver environment variable if it's already exist and different from current
188188
/// </summary>
189189
/// <param name="variable">Environment variable</param>
190-
// TODO : Temporary disable this functionality because of wrong path override
191-
public static void UpdatePath(string variable)
190+
/// <param name="extendPath">Extend PATH variable with driver variable</param>
191+
public static void UpdatePath(string variable, bool extendPath = false)
192192
{
193193
try
194194
{
195-
// const string name = "PATH";
196-
// var pathVariable = Environment.GetEnvironmentVariable(name);
197-
// var newPathVariable = pathVariable + (pathVariable != null && pathVariable.EndsWith(";") ? string.Empty : ";") + $@"%{variable}%";
198-
// if (pathVariable != null && !pathVariable.Contains(DesticationFolder) && !pathVariable.Contains(variable))
199-
// Environment.SetEnvironmentVariable(newPathVariable, name, EnvironmentVariableTarget.Machine);
195+
if (!extendPath) return;
196+
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(DesticationFolder) &&
202+
!pathVariable.Contains(variable))
203+
Environment.SetEnvironmentVariable(newPathVariable, name, EnvironmentVariableTarget.Machine);
200204
}
201205
catch (Exception ex)
202206
{
@@ -213,29 +217,31 @@ public static void Install(string command)
213217
{
214218
try
215219
{
216-
if (File.Exists(DesticationFile) && IsNew)
220+
if (!File.Exists(DesticationFile) || !IsNew) return;
221+
var startInfo = new ProcessStartInfo
217222
{
218-
ProcessStartInfo startInfo = new ProcessStartInfo
219-
{
220-
UseShellExecute = false,
221-
WindowStyle = ProcessWindowStyle.Hidden,
222-
FileName = DesticationFile,
223-
Arguments = command
224-
};
225-
Process process = new Process
226-
{
227-
StartInfo = startInfo
228-
};
229-
process.Start();
230-
process.WaitForExit();
231-
}
223+
UseShellExecute = false,
224+
WindowStyle = ProcessWindowStyle.Hidden,
225+
FileName = DesticationFile,
226+
Arguments = command
227+
};
228+
var process = new Process
229+
{
230+
StartInfo = startInfo
231+
};
232+
process.Start();
233+
process.WaitForExit();
232234
}
233235
catch (Exception ex)
234236
{
235237
HLog.Error(ex,
236-
$"Error occurred during application installation from file '{DesticationFile}' using command '{command}'");
238+
"Error occurred during application installation " +
239+
$"from file '{DesticationFile}' " +
240+
$"using command '{command}'");
237241
throw new WebDriverManagerException(
238-
$"Error occurred during application installation from file '{DesticationFile}' using command '{command}'",
242+
"Error occurred during application installation " +
243+
$"from file '{DesticationFile}' " +
244+
$"using command '{command}'",
239245
ex);
240246
}
241247
}

WebDriverManager/Helpers/WebDriverManagerConfig.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,20 @@
22
{
33
public class WebDriverManagerConfig
44
{
5-
public readonly string DefaultDestinationFolder = "Drivers";
5+
public const string DefaultDestinationFolder = "Drivers";
66

7-
public string Architecture { get; set; } = null;
7+
public string Architecture { get; set; }
88

9-
public string Binary { get; set; } = null;
9+
public string Binary { get; set; }
1010

11-
public string Release { get; set; } = null;
11+
public string Release { get; set; }
1212

13-
public string Version { get; set; } = null;
13+
public string Version { get; set; }
1414

15-
public string Url { get; set; } = null;
15+
public string Url { get; set; }
1616

17-
public string Destication { get; set; } = null;
17+
public string Destication { get; set; }
1818

19-
public string PathVariable { get; set; } = null;
19+
public string PathVariable { get; set; }
2020
}
2121
}

0 commit comments

Comments
 (0)