Skip to content

Commit

Permalink
Add download directory for webDrivers ( rosolko#167 )
Browse files Browse the repository at this point in the history
  • Loading branch information
DSPaul committed Jun 11, 2022
1 parent df5ac4e commit 87b6400
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):this()
{
_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 87b6400

Please sign in to comment.