diff --git a/WebDriverManager/DriverManager.cs b/WebDriverManager/DriverManager.cs index 7660610..e85d254 100644 --- a/WebDriverManager/DriverManager.cs +++ b/WebDriverManager/DriverManager.cs @@ -1,4 +1,5 @@ using System; +using System.IO; using System.Net; using WebDriverManager.DriverConfigs; using WebDriverManager.Helpers; @@ -13,6 +14,7 @@ public class DriverManager private IBinaryService _binaryService; private readonly IVariableService _variableService; + private string _downloadDirectory = Directory.GetCurrentDirectory(); public DriverManager() { @@ -20,6 +22,11 @@ public DriverManager() _variableService = new VariableService(); } + public DriverManager(string downloadDirectory):this() + { + _downloadDirectory = downloadDirectory; + } + public DriverManager(IBinaryService binaryService, IVariableService variableService) { _binaryService = binaryService; @@ -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); } }