File: getCacheRootPath.R

package info (click to toggle)
r-cran-r.cache 0.17.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 392 kB
  • sloc: sh: 14; makefile: 2
file content (29 lines) | stat: -rw-r--r-- 558 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
library("R.cache")
setupCacheRootPath <- R.cache:::setupCacheRootPath

oopts <- options()

tmpdir <- tempdir()
setCacheRootPath(path=tmpdir)

print(getCacheRootPath())

setupCacheRootPath(defaultPath=tmpdir)
path <- getCacheRootPath(NULL)
print(path)
stopifnot(identical(path, tmpdir))

options("R.cache.rootPath"=NULL)
print(getCacheRootPath())

path <- getCacheRootPath(NULL)
print(path)
stopifnot(is.null(path))
setupCacheRootPath(defaultPath=tmpdir)

path <- getCacheRootPath(NULL)
print(path)
stopifnot(identical(path, tmpdir))

## Reset
options(oopts)