Skip to content

Commit

Permalink
move .onLoad call to setup, try using backports::R_user_dir again
Browse files Browse the repository at this point in the history
  • Loading branch information
japhir committed Mar 5, 2024
1 parent d0fc842 commit fcba204
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 6 deletions.
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ export(.data)
export(get_solution)
export(prepare_solution)
export(snvec)
if (getRversion() >= "4.0.0") {importFrom(tools,R_user_dir)} else {importFrom(backports,tools)}
importFrom(rlang,.data)
4 changes: 0 additions & 4 deletions R/get_solution.R
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,3 @@ basename(raw_path)}} to cache.",
return(raw)
}
}

.onLoad <- function(libname, pkgname) {
backports::import(pkgname, "R_user_dir")
}
1 change: 1 addition & 0 deletions R/snvecR-package.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@
# ' @importFrom tibble tibble
# ' @importFrom tidyselect all_of
# ' @importFrom utils menu
#' @rawNamespace if (getRversion() >= "4.0.0") {importFrom(tools,R_user_dir)} else {importFrom(backports,tools)}
## usethis namespace: end
NULL
2 changes: 1 addition & 1 deletion man/snvec.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion tests/testthat/setup.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
.onLoad <- function(libname, pkgname) {
backports::import(pkgname, c("R_user_dir"))
}

cleanup <- function() {
cachedir <- tools::R_user_dir("snvecR", which = "cache")
cachedir <- R_user_dir("snvecR", which = "cache")
if (dir.exists(cachedir) && !interactive()) {
cli::cli_inform("Removing {.file {cachedir}} from reproducible environment.")
unlink(cachedir, recursive = TRUE)
Expand Down

0 comments on commit fcba204

Please sign in to comment.