1616# ' code until you run `cpp_vendor()` again.
1717# '
1818# ' @inheritParams cpp_register
19+ # ' @param headers The path to the cpp11 headers to vendor. By default this is
20+ # ' the path where R installed the cpp11 package. You can change this to
21+ # ' use a different version of cpp11, such as as the development version
22+ # ' from GitHub.
1923# ' @return The file path to the vendored code (invisibly).
2024# ' @export
2125# ' @examples
3034# '
3135# ' # cleanup
3236# ' unlink(dir, recursive = TRUE)
33- cpp_vendor <- function (path = " ." ) {
37+ cpp_vendor <- function (path = " ." , headers = system.file( " include " , " cpp11 " , package = " cpp11 " ) ) {
3438 new <- file.path(path , " inst" , " include" , " cpp11" )
3539
3640 if (dir.exists(new )) {
@@ -39,16 +43,15 @@ cpp_vendor <- function(path = ".") {
3943
4044 dir.create(new , recursive = TRUE , showWarnings = FALSE )
4145
42- current <- system.file(" include" , " cpp11" , package = " cpp11" )
43- if (! nzchar(current )) {
46+ if (! nzchar(headers )) {
4447 stop(" cpp11 is not installed" , call. = FALSE )
4548 }
4649
4750 cpp11_version <- utils :: packageVersion(" cpp11" )
4851
4952 cpp11_header <- sprintf(" // cpp11 version: %s\n // vendored on: %s" , cpp11_version , Sys.Date())
5053
51- files <- list.files(current , full.names = TRUE )
54+ files <- list.files(headers , full.names = TRUE )
5255
5356 writeLines(
5457 c(cpp11_header , readLines(system.file(" include" , " cpp11.hpp" , package = " cpp11" ))),
0 commit comments