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 )) {
@@ -40,16 +44,15 @@ cpp_vendor <- function(path = ".") {
4044
4145 dir.create(new , recursive = TRUE , showWarnings = FALSE )
4246
43- current <- system.file(" include" , " cpp11" , package = " cpp11" )
44- if (! nzchar(current )) {
47+ if (! nzchar(headers )) {
4548 stop(" cpp11 is not installed" , call. = FALSE )
4649 }
4750
4851 cpp11_version <- utils :: packageVersion(" cpp11" )
4952
5053 cpp11_header <- sprintf(" // cpp11 version: %s\n // vendored on: %s" , cpp11_version , Sys.Date())
5154
52- files <- list.files(current , full.names = TRUE )
55+ files <- list.files(headers , full.names = TRUE )
5356
5457 writeLines(
5558 c(cpp11_header , readLines(system.file(" include" , " cpp11.hpp" , package = " cpp11" ))),
0 commit comments