From 8eee0e231e9b75d8e5b0d0089980bbc309ef1d0f Mon Sep 17 00:00:00 2001 From: Duncan Temple Lang Date: Sat, 18 May 2019 13:50:51 -0700 Subject: [PATCH] add the / to the key if necessary --- Rqpdf/R/info.R | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Rqpdf/R/info.R b/Rqpdf/R/info.R index fea5c67..148087b 100644 --- a/Rqpdf/R/info.R +++ b/Rqpdf/R/info.R @@ -5,6 +5,11 @@ function(file, key) file = path.expand(file) if(!file.exists(file)) stop("no such file ", file) + + # keys start with a / and if we omit this we get NA back. + # So we add it for the caller if it is not there. + if(!grepl("^/", key)) + key = paste0("/", key) .Call("R_get_pdf_info_val", file, as.character(key)) }