Skip to content

Commit

Permalink
Fix binary setup (#162)
Browse files Browse the repository at this point in the history
Co-authored-by: n-ski <[email protected]>
  • Loading branch information
rosolko and n-ski authored Dec 14, 2021
1 parent 97052d5 commit 6b0ee22
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions WebDriverManager/Services/Impl/BinaryService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,13 @@ public string SetupBinary(string url, string zipDestination, string binDestinati

public string SetupBinary(string url, string zipPath, string binaryPath)
{
var zipDir = Path.GetDirectoryName(zipPath);
var binaryDir = Path.GetDirectoryName(binaryPath);
var binaryName = Path.GetFileName(binaryPath);

//
// If the destination already exists, we don't have to do anything
//
if (Directory.Exists(binaryDir)) return binaryPath;
if (File.Exists(binaryPath)) return binaryPath;

var zipDir = Path.GetDirectoryName(zipPath);
var binaryName = Path.GetFileName(binaryPath);

//
// Download the driver
Expand Down Expand Up @@ -70,10 +69,15 @@ public string SetupBinary(string url, string zipPath, string binaryPath)
}
#endif

var binaryDir = Path.GetDirectoryName(binaryPath);

//
// Create the destination directory if it doesn't exist
//
Directory.CreateDirectory(binaryDir);
if (!Directory.Exists(binaryDir))
{
Directory.CreateDirectory(binaryDir);
}

//
// Atomically rename the staging directory to the destination directory
Expand Down

0 comments on commit 6b0ee22

Please sign in to comment.