diff --git a/R/S2_download.R b/R/S2_download.R index 1c6ee8a..be09511 100644 --- a/R/S2_download.R +++ b/R/S2_download.R @@ -75,7 +75,7 @@ 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])) { @@ -83,9 +83,10 @@ S2_download = function(url, destfile, zip = TRUE, skipExisting = TRUE, progressB } if (progressBar) { - setTxtProgressBar(pb, i) + utils::setTxtProgressBar(pb, i) } + breakLoop = FALSE tryCatch( { curl::curl_download(url = url[i], destfile = destfile[i], quiet = TRUE) @@ -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)) diff --git a/man/S2_download.Rd b/man/S2_download.Rd index 68f4539..ad389a1 100644 --- a/man/S2_download.Rd +++ b/man/S2_download.Rd @@ -33,7 +33,7 @@ Simple helper function to download data (granules, images, QI data) \examples{ \dontrun{ # find, download and unzip a full granule - granules <- S2_query_granule( + granules = S2_query_granule( utm = '33UXP', dateMin = '2016-06-01', dateMax = '2016-06-30' @@ -41,7 +41,7 @@ Simple helper function to download data (granules, images, QI data) S2_download(granules$url, granules$date) # find and download a bunch of images - images <- S2_query_image( + images = S2_query_image( utm = '33UXP', dateMin = '2016-06-01', dateMax = '2016-06-30',