Skip to content

Commit dc17457

Browse files
committed
Revert "don't use cacheDir for code temp file (creates permanent litter)"
This reverts commit f04c9ed.
1 parent 6f43bb5 commit dc17457

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

R/Attributes.R

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)