|
3 | 3 | #' @family cache utilities |
4 | 4 | #' @seealso [rappdirs::user_config_dir()] |
5 | 5 | #' |
6 | | -#' @return An (invisible) character with the path to your `cache_dir`. |
| 6 | +#' @rdname catrnav_set_cache_dir |
| 7 | +#' |
| 8 | +#' @return |
| 9 | +#' [catrnav_set_cache_dir()] is called for its side effects, and returns an |
| 10 | +#' (invisible) character with the path to your `cache_dir`. |
| 11 | +#' |
7 | 12 | #' @description |
8 | | -#' This function will store your `cache_dir` path on your local machine and |
9 | | -#' would load it for future sessions. Type `Sys.getenv("CATASTRONAV_CACHE_DIR")` |
10 | | -#' to find your cached path. |
| 13 | +#' [catrnav_set_cache_dir()] will store your `cache_dir` path on your local |
| 14 | +#' machine and would load it for future sessions. |
11 | 15 | #' |
12 | 16 | #' Alternatively, you can store the `cache_dir` manually with the following |
13 | 17 | #' options: |
14 | 18 | #' * Run `Sys.setenv(CATASTRONAV_CACHE_DIR = "cache_dir")`. You would need to |
15 | 19 | #' run this command on each session (Similar to `install = FALSE`). |
16 | | -#' * Write this line on your `.Renviron` file: |
| 20 | +#' * Write this line on your .Renviron file: |
17 | 21 | #' `CATASTRONAV_CACHE_DIR = "value_for_cache_dir"` (same behavior than |
18 | 22 | #' `install = TRUE`). This would store your `cache_dir` permanently. |
19 | 23 | #' |
|
44 | 48 | #' catrnav_set_cache_dir(verbose = TRUE) |
45 | 49 | #' } |
46 | 50 | #' |
47 | | -#' Sys.getenv("CATASTRONAV_CACHE_DIR") |
48 | 51 | #' @export |
49 | 52 | catrnav_set_cache_dir <- function(cache_dir, |
50 | 53 | overwrite = FALSE, |
@@ -128,6 +131,35 @@ catrnav_set_cache_dir <- function(cache_dir, |
128 | 131 | } |
129 | 132 |
|
130 | 133 |
|
| 134 | +#' @rdname catrnav_set_cache_dir |
| 135 | +#' @name catrnav_detect_cache_dir |
| 136 | +#' |
| 137 | +#' @export |
| 138 | +#' |
| 139 | +#' @description |
| 140 | +#' [catrnav_detect_cache_dir()] detects and returns the path to your current |
| 141 | +#' `cache_dir`. |
| 142 | +#' |
| 143 | +#' @param ... Ignored |
| 144 | +#' @return |
| 145 | +#' [catrnav_detect_cache_dir()] returns the path to the `cache_dir` used in this |
| 146 | +#' session |
| 147 | +#' |
| 148 | +#' @examples |
| 149 | +#' |
| 150 | +#' catrnav_detect_cache_dir() |
| 151 | +#' |
| 152 | +catrnav_detect_cache_dir <- function(...) { |
| 153 | + # nocov start |
| 154 | + # This is just a wrapper |
| 155 | + |
| 156 | + list(...) |
| 157 | + cache <- catrnav_hlp_detect_cache_dir() |
| 158 | + |
| 159 | + cache |
| 160 | + # nocov end |
| 161 | +} |
| 162 | + |
131 | 163 | #' Detect cache dir for CatastRoNav |
132 | 164 | #' |
133 | 165 | #' @noRd |
|
0 commit comments