|
12 | 12 | #' - **tabset**: Insert a tabset structure |
13 | 13 | #' |
14 | 14 | #' @details |
15 | | -#' The snippets are installed in your RStudio snippets file for R: |
| 15 | +#' By default the snippets are written to a temporary file (inside `tempdir()`) |
| 16 | +#' to comply with CRAN's restriction on writing to the user's filespace during |
| 17 | +#' examples, vignettes, and tests. To install in your actual RStudio snippets |
| 18 | +#' file, provide the explicit path via `path`, for example: |
16 | 19 | #' - Windows: `%APPDATA%/RStudio/snippets/r.snippets` |
17 | 20 | #' - Mac/Linux: `~/.config/rstudio/snippets/r.snippets` |
18 | 21 | #' |
|
27 | 30 | #' |
28 | 31 | #' @param backup Logical. If TRUE (default), creates a backup of your existing |
29 | 32 | #' snippets file before modifying it. |
30 | | -#' @param path Character. Custom path for the snippets file. If NULL (default), |
31 | | -#' uses the standard RStudio snippets location. For examples/tests, use tempdir(). |
| 33 | +#' @param path Character. Path for the snippets file. Defaults to writing in |
| 34 | +#' `tempdir()` to comply with CRAN policies. Provide an explicit path when you |
| 35 | +#' intentionally want to install into your RStudio snippets directory. |
32 | 36 | #' |
33 | 37 | #' @return Invisibly returns the path to the snippets file. |
34 | 38 | #' |
|
46 | 50 | #' # For testing: install to temp directory |
47 | 51 | #' temp_snippets <- file.path(tempdir(), "r.snippets") |
48 | 52 | #' install_quartify_snippets(path = temp_snippets) |
49 | | -install_quartify_snippets <- function(backup = TRUE, path = NULL) { |
| 53 | +install_quartify_snippets <- function(backup = TRUE, path = file.path(tempdir(), "r.snippets")) { |
50 | 54 | # Define the snippets content |
51 | 55 | snippets <- ' |
52 | 56 | # quartify snippets |
|
0 commit comments