Skip to content

Commit

Permalink
Allows the session path to be different than the cache path
Browse files Browse the repository at this point in the history
  • Loading branch information
dipterix committed Jul 31, 2024
1 parent 83ff0f1 commit dcd0301
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: ravedash
Type: Package
Title: Dashboard System for Reproducible Visualization of 'iEEG'
Version: 0.1.3.32
Version: 0.1.3.33
Authors@R: c(
person("Zhengjia", "Wang", email = "dipterix.wang@gmail.com", role = c("aut", "cre", "cph"))
)
Expand Down Expand Up @@ -40,7 +40,7 @@ Suggests:
httr,
rmarkdown,
testthat (>= 3.0.0)
RoxygenNote: 7.3.1
RoxygenNote: 7.3.2
URL: https://dipterix.org/ravedash/
BugReports: https://github.com/dipterix/ravedash/issues
VignetteBuilder: knitr
Expand Down
17 changes: 12 additions & 5 deletions R/core-app.R
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
session_root <- function(ensure = FALSE){
cache_path <- raveio::raveio_getopt("tensor_temp_path", default = file.path(tempdir(), "rave2-session"))
if( ensure && !dir.exists(cache_path) ){
raveio::dir_create2(cache_path)
path <- raveio::raveio_getopt("ravedash_session_root", default = NA)
if(length(path) != 1 || is.na(path) || !is.character(path)) {
path <- raveio::raveio_getopt("tensor_temp_path", default = NA)
if(length(path) != 1 || is.na(path) || !is.character(path)) {
path <- file.path(tempdir(), "rave2-session")
}
}

if( ensure && !dir.exists(path) ){
raveio::dir_create2(path)
}
normalizePath(cache_path, mustWork = FALSE)
normalizePath(path, mustWork = FALSE)
}

ensure_template <- function(path, use_cache = TRUE){
Expand Down Expand Up @@ -608,7 +615,7 @@ temp_dir <- function(
}
}
if(persist == "package-cache") {
root <- file.path(raveio::cache_root(), "app_tmp")
root <- file.path(session_root(), "package-cache")
}
if(persist == "process") {
root <- tempdir()
Expand Down

0 comments on commit dcd0301

Please sign in to comment.