diff --git a/DESCRIPTION b/DESCRIPTION index 92a17d6..d6c2be2 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -37,10 +37,11 @@ Imports: googledrive, yaml, stringr, knitr (>= 1.33), - qpdf + qpdf, Suggests: remotes, - testthat + testthat, + downloader Encoding: UTF-8 LazyData: true Remotes: jhudsl/text2speech, diff --git a/R/example_data.R b/R/example_data.R index 3b663ad..818fe0a 100644 --- a/R/example_data.R +++ b/R/example_data.R @@ -35,7 +35,7 @@ bad_quiz_path <- function() { #' @param dest_dir The destination directory you would like the example repo files to be placed. By default is current directory. #' @export #' -#' @importFrom utils download.file +#' @importFrom downloader download #' @importFrom utils unzip #' @examples #' @@ -47,19 +47,12 @@ example_repo_setup <- function(dest_dir = ".") { if (!dir.exists(dest_dir)) { dir.create(dest_dir) } - download.file(url = "https://github.com/jhudsl/DaSL_Course_Template_Leanpub/raw/main/example-repo.zip", - destfile = zip_file) + downloader::download(url = "https://github.com/jhudsl/DaSL_Course_Template_Leanpub/raw/main/example-repo.zip", + destfile = zip_file, + mode = "wb") - # See what unzip is being used - operating_system <- Sys.info()[1] - message(operating_system) - if (operating_system == "Windows" ){ - # Unzip function doesn't always work for windows - system(paste("7z a -tzip", zip_file, dest_dir)) - } else { - # Unzip the folder - utils::unzip(zip_file, exdir = dest_dir) - } + # Unzip the folder + utils::unzip(zip_file, exdir = dest_dir) } #' Clean up example repo files