Skip to content

Commit 6b0ee22

Browse files
rosolkon-ski
andauthored
Fix binary setup (#162)
Co-authored-by: n-ski <[email protected]>
1 parent 97052d5 commit 6b0ee22

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

WebDriverManager/Services/Impl/BinaryService.cs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,13 @@ public string SetupBinary(string url, string zipDestination, string binDestinati
2222

2323
public string SetupBinary(string url, string zipPath, string binaryPath)
2424
{
25-
var zipDir = Path.GetDirectoryName(zipPath);
26-
var binaryDir = Path.GetDirectoryName(binaryPath);
27-
var binaryName = Path.GetFileName(binaryPath);
28-
2925
//
3026
// If the destination already exists, we don't have to do anything
3127
//
32-
if (Directory.Exists(binaryDir)) return binaryPath;
28+
if (File.Exists(binaryPath)) return binaryPath;
29+
30+
var zipDir = Path.GetDirectoryName(zipPath);
31+
var binaryName = Path.GetFileName(binaryPath);
3332

3433
//
3534
// Download the driver
@@ -70,10 +69,15 @@ public string SetupBinary(string url, string zipPath, string binaryPath)
7069
}
7170
#endif
7271

72+
var binaryDir = Path.GetDirectoryName(binaryPath);
73+
7374
//
7475
// Create the destination directory if it doesn't exist
7576
//
76-
Directory.CreateDirectory(binaryDir);
77+
if (!Directory.Exists(binaryDir))
78+
{
79+
Directory.CreateDirectory(binaryDir);
80+
}
7781

7882
//
7983
// Atomically rename the staging directory to the destination directory

0 commit comments

Comments
 (0)