Skip to contents

Test helper to create a temporary directory

Usage

local_mk_dir(
  dir = fs::file_temp(pattern = "R-dimex-tst-dir_"),
  envir = parent.frame()
)

Arguments

dir

A temporary directory as a character string or as would be returned by fs::file_temp().

envir

The environment to use for scoping which must default to parent.frame() - do NOT changed this by supplying an alternative as this is used by withr::defer().

Value

The name of the temporary directory as a character string (not as an fs_path object).

Examples

if (FALSE) { # \dontrun{
tmp_dir <- local_mk_dir()
} # }