Skip to content

Commit

Permalink
Fix for conf path
Browse files Browse the repository at this point in the history
  • Loading branch information
jeroen committed Jun 9, 2017
1 parent fb8b781 commit c575860
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions R/unrtf.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,17 @@ unrtf <- function(file = NULL, format = c("html", "text", "latex"), verbose = FA
args <- if(length(file)){
if(grepl("^https?://", file)){
tmp <- tempfile(fileext = ".rtf")
utils::download.file(file, tmp, mode = "wb")
utils::download.file(file, tmp, mode = "wb", quiet = !verbose)
file <- tmp
}
file <- normalizePath(file, mustWork = TRUE)
# Path with spaces need shQuote() on Windows, see https://github.com/jeroen/sys/issues/4
c(
if(verbose)
"--verbose",
paste0("--", format),
if(length(conf_dir))
paste("-P", conf_dir),
c("-P", normalizePath(conf_dir, mustWork = TRUE)),
paste0("--", format),
ifelse(is_windows(), shQuote(file), file)
)
}
Expand All @@ -47,6 +47,8 @@ unrtf <- function(file = NULL, format = c("html", "text", "latex"), verbose = FA
path <- file.path(bindir, paste0("unrtf", postfix))
outcon <- rawConnection(raw(0), "r+")
on.exit(close(outcon), add = TRUE)
if(verbose)
cat(sprintf("Calling: %s %s\n", path, paste(args, collapse = " ")), file = stderr())
status <- sys::exec_wait(path, args, std_out = outcon)
if(status != 0)
stop("System call to 'unrtf' failed", call. = FALSE)
Expand Down

0 comments on commit c575860

Please sign in to comment.