Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove setting working directory #10

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions R/download_springer_book_files.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Generate all pdf's in the directories organized by book type

#' Generate all pdf's in the directories organized by book type
#'
#' @param springer_book_titles character vector of books to download. If not specified, all books will be downloaded.
#' @param springer_table table of available books to download.
#' @param destination_folder folder to save the books to.
download_springer_book_files <- function(springer_books_titles = NA, springer_table = NA, destination_folder = 'springer_quarantine_books') {

if (is.na(springer_table)) {
Expand All @@ -26,14 +29,12 @@ download_springer_book_files <- function(springer_books_titles = NA, springer_ta
pull(english_package_name) %>%
unique()

current_folder = file.path(destination_folder, en_book_type)
current_folder <- file.path(destination_folder, en_book_type)
if (!dir.exists(current_folder)) { dir.create(current_folder, recursive = T) }
setwd(current_folder)
tic('Time processed')
springerQuarantineBooksR::download_springer_book(title, springer_table)
springerQuarantineBooksR::download_springer_book(title, springer_table, dest_dir = current_folder)
toc()
setwd(file.path('.', '..', '..'))


i <- i + 1

}
Expand Down