Skip to content

Commit

Permalink
Fixes issue #15. Overwrite files in tempdir() (#34)
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Fannin authored and leeper committed Feb 7, 2017
1 parent b2e7791 commit 02d4f30
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
@@ -1,7 +1,7 @@
Package: tabulizer
Type: Package
Title: Bindings for Tabula PDF Table Extractor Library
Version: 0.1.22
Version: 0.1.23
Authors@R: c(person("Thomas J.", "Leeper", role = c("aut", "cre"),
email = "thosjleeper@gmail.com"),
person("David", "Gohel", role = "ctb",
Expand Down
6 changes: 5 additions & 1 deletion R/utils.R
Expand Up @@ -10,7 +10,11 @@ localize_file <- function(path, copy = FALSE, quiet = TRUE) {
} else {
if (copy) {
tmp <- file.path(tempdir(), paste0(basename(file_path_sans_ext(path.expand(path))), ".pdf"))
file.copy(from = path.expand(path), to = tmp)
if (file.exists(tmp)){
message("There is already a file with this name in the temporary directory. It will be overwritten.")
}
file_to <- path.expand(path)
if (file_to != tmp) file.copy(from = file_to, to = tmp, overwrite = TRUE)
path <- tmp
} else {
path <- path.expand(path)
Expand Down

0 comments on commit 02d4f30

Please sign in to comment.