Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to set download directory for webDrivers ( #167 ) #192

Merged
merged 3 commits into from Jun 27, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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