Skip to content

Commit

Permalink
add readline to clear_fn_bodies_dir to ensure uninject prior to clear…
Browse files Browse the repository at this point in the history
…_traces for #19
  • Loading branch information
mpadge committed Jun 23, 2023
1 parent e35d3cc commit 74a9f4b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: typetracer
Title: Trace Function Parameter Types
Version: 0.2.1.007
Version: 0.2.1.008
Authors@R: c(
person("Mark", "Padgham", , "[email protected]", role = c("aut", "cre"),
comment = c(ORCID = "0000-0003-2172-5265")),
Expand Down
13 changes: 13 additions & 0 deletions R/directory-fns.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,19 @@ clear_fn_bodies_dir <- function () {

fn_bodies_dir <- file.path (get_typetrace_dir (), "fn_bodies")
if (dir.exists (fn_bodies_dir)) {
has_files <- length (list.files (fn_bodies_dir)) > 0L
if (has_files && interactive ()) {
chk <- readline (paste0 (
"All functions should first be uninjected before calling ",
"this function. Do you wish to continue (y/n)? "
))
if (tolower (substring (chk, 1, 1)) != "y") {
stop (
"Please call 'uninject_tracer(<fn_name>) first",
call. = FALSE
)
}
}
unlink (fn_bodies_dir, recursive = TRUE)
}
}
Expand Down
2 changes: 1 addition & 1 deletion codemeta.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"codeRepository": "https://github.com/mpadge/typetracer",
"issueTracker": "https://github.com/mpadge/typetracer/issues",
"license": "https://spdx.org/licenses/MIT",
"version": "0.2.1.007",
"version": "0.2.1.008",
"programmingLanguage": {
"@type": "ComputerLanguage",
"name": "R",
Expand Down

0 comments on commit 74a9f4b

Please sign in to comment.