Skip to content

Commit

Permalink
Add ability to set download directory for webDrivers ( #167 ) (#192)
Browse files Browse the repository at this point in the history
Co-authored-by: Aliaksandr Rasolka <rosolko@gmail.com>
  • Loading branch information
DSPaul and rosolko committed Jun 27, 2022
1 parent a7e78e1 commit d555221
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions WebDriverManager/DriverManager.cs
@@ -1,4 +1,5 @@
using System;
using System.IO;
using System.Net;
using WebDriverManager.DriverConfigs;
using WebDriverManager.Helpers;
Expand All @@ -13,13 +14,19 @@ public class DriverManager

private IBinaryService _binaryService;
private readonly IVariableService _variableService;
private string _downloadDirectory = Directory.GetCurrentDirectory();

public DriverManager()
{
_binaryService = new BinaryService();
_variableService = new VariableService();
}

public DriverManager(string downloadDirectory)
{
_downloadDirectory = downloadDirectory;
}

public DriverManager(IBinaryService binaryService, IVariableService variableService)
{
_binaryService = binaryService;
Expand Down Expand Up @@ -61,8 +68,7 @@ public string SetUpDriver(string url, string binaryPath)
version = GetVersionToDownload(config, version);
var url = architecture.Equals(Architecture.X32) ? config.GetUrl32() : config.GetUrl64();
url = UrlHelper.BuildUrl(url, version);
var binaryPath = FileHelper.GetBinDestination(config.GetName(), version, architecture,
config.GetBinaryName());
var binaryPath = Path.Combine(_downloadDirectory, config.GetName(), version, architecture.ToString(), config.GetBinaryName());
return SetUpDriverImpl(url, binaryPath);
}
}
Expand Down

0 comments on commit d555221

Please sign in to comment.