Skip to content

Commit

Permalink
Bug-fix: honor forceDownload() option (related to #186)
Browse files Browse the repository at this point in the history
  • Loading branch information
bonigarcia committed Mar 12, 2018
1 parent 68844ea commit 3da201a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
7 changes: 6 additions & 1 deletion src/main/java/io/github/bonigarcia/wdm/Downloader.java
Expand Up @@ -118,7 +118,12 @@ private Optional<File> downloadAndExtract(URL url, File targetFile,
extractedFile = temporaryFile;
}
File resultingBinary = new File(targetFolder, extractedFile.getName());
if (!resultingBinary.exists()) {
boolean binaryExists = resultingBinary.exists();
if (!binaryExists || config().isOverride()) {
if (binaryExists) {
log.debug("Overriding former binary {}", resultingBinary);
deleteFile(resultingBinary);
}
moveFileToDirectory(extractedFile, targetFolder, true);
}
if (!config().isExecutable(resultingBinary)) {
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/io/github/bonigarcia/wdm/WebDriverManager.java
Expand Up @@ -376,14 +376,14 @@ protected void manage(Architecture arch, String version) {
boolean cache = config().isForceCache() || !isNetAvailable();

String driverNameString = listToString(getDriverName());
log.trace(">> Managing {} arch={} version={} getLatest={} cache={}",
log.trace("Managing {} arch={} version={} getLatest={} cache={}",
driverNameString, arch, version, getLatest, cache);

Optional<String> driverInCache = handleCache(arch, version,
getLatest, cache);

String versionStr = getLatest ? "(latest version)" : version;
if (driverInCache.isPresent()) {
if (driverInCache.isPresent() && !config().isOverride()) {
versionToDownload = version;
downloadedVersion = version;
log.debug("Driver for {} {} found in cache {}",
Expand Down

0 comments on commit 3da201a

Please sign in to comment.