Skip to content

Commit

Permalink
Make R check happy.
Browse files Browse the repository at this point in the history
  • Loading branch information
zozlak committed Dec 18, 2018
1 parent 640add3 commit 5f94c7c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
10 changes: 7 additions & 3 deletions R/S2_download.R
Original file line number Diff line number Diff line change
Expand Up @@ -75,17 +75,18 @@ S2_download = function(url, destfile, zip = TRUE, skipExisting = TRUE, progressB

success = rep(FALSE, length(url))
if (progressBar) {
pb = txtProgressBar(0, length(url), style = 3)
pb = utils::txtProgressBar(0, length(url), style = 3)
}
for (i in seq_along(url)) {
if (isTRUE(skipExisting) && file.exists(destfile[i])) {
next
}

if (progressBar) {
setTxtProgressBar(pb, i)
utils::setTxtProgressBar(pb, i)
}

breakLoop = FALSE
tryCatch(
{
curl::curl_download(url = url[i], destfile = destfile[i], quiet = TRUE)
Expand All @@ -102,10 +103,13 @@ S2_download = function(url, destfile, zip = TRUE, skipExisting = TRUE, progressB
},
warning = function(w) {
if (all(w$message == 'Operation was aborted by an application callback')) {
break
breakLoop <<- TRUE
}
}
)
if (breakLoop) {
break
}
}

return(invisible(success))
Expand Down
4 changes: 2 additions & 2 deletions man/S2_download.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 5f94c7c

Please sign in to comment.