Skip to content

Commit 5b79cf1

Browse files
committed
Refactor java_download
Just to reduce some cyclomatic complexity
1 parent d75eb92 commit 5b79cf1

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

R/java_download.R

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,15 +150,17 @@ java_download <- function(
150150
.envir = environment()
151151
)
152152
}
153-
} else if (file.exists(dest_file) & force) {
153+
return(dest_file)
154+
}
155+
156+
if (file.exists(dest_file) & force) {
154157
if (!quiet) {
155158
cli::cli_inform("Removing existing installation.", .envir = environment())
156159
}
157160
file.remove(dest_file)
158-
download_dist_check_md5(url, dest_file, quiet)
159-
} else if (!file.exists(dest_file)) {
160-
download_dist_check_md5(url, dest_file, quiet)
161161
}
162162

163+
download_dist_check_md5(url, dest_file, quiet)
164+
163165
return(dest_file)
164166
}

0 commit comments

Comments
 (0)