Skip to content

Commit f04c9ed

Browse files
committed
don't use cacheDir for code temp file (creates permanent litter)
1 parent a882203 commit f04c9ed

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,18 +28,11 @@ 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-
3831
# resolve code into a file if necessary. also track the working
3932
# directory to source the R embedded code chunk within
4033
if (!missing(code)) {
4134
rWorkingDir <- getwd()
42-
file <- tempfile(fileext = ".cpp", tmpdir = cacheDir)
35+
file <- tempfile(fileext = ".cpp")
4336
con <- file(file, open = "w")
4437
writeLines(code, con)
4538
close(con)
@@ -64,6 +57,13 @@ sourceCpp <- function(file = "",
6457
}
6558
}
6659

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)