@@ -28,11 +28,18 @@ sourceCpp <- function(file = "",
2828 verbose = getOption(" verbose" ),
2929 dryRun = FALSE ) {
3030
31+ # use an architecture/version specific subdirectory of the cacheDir
32+ # (since cached dynlibs can now perist across sessions we need to be
33+ # sure to invalidate them when R or Rcpp versions change)
34+ cacheDir <- path.expand(cacheDir )
35+ cacheDir <- normalizePath(cacheDir , winslash = " /" , mustWork = FALSE )
36+ cacheDir <- .sourceCppPlatformCacheDir(cacheDir )
37+
3138 # resolve code into a file if necessary. also track the working
3239 # directory to source the R embedded code chunk within
3340 if (! missing(code )) {
3441 rWorkingDir <- getwd()
35- file <- tempfile(fileext = " .cpp" )
42+ file <- tempfile(fileext = " .cpp" , tmpdir = cacheDir )
3643 con <- file(file , open = " w" )
3744 writeLines(code , con )
3845 close(con )
@@ -57,13 +64,6 @@ sourceCpp <- function(file = "",
5764 }
5865 }
5966
60- # use an architecture/version specific subdirectory of the cacheDir
61- # (since cached dynlibs can now perist across sessions we need to be
62- # sure to invalidate them when R or Rcpp versions change)
63- cacheDir <- path.expand(cacheDir )
64- cacheDir <- normalizePath(cacheDir , winslash = " /" , mustWork = FALSE )
65- cacheDir <- .sourceCppPlatformCacheDir(cacheDir )
66-
6767 # get the context (does code generation as necessary)
6868 context <- .Call(" sourceCppContext" , PACKAGE = " Rcpp" ,
6969 file , code , rebuild , cacheDir , .Platform )
0 commit comments