Check if data directory exists and create a new directory if needed
Source:R/standalone-get-data-dir.R
get_data_dir.Rd
Get the path for a package-specific cache directory with
rappdirs::user_cache_dir()
, check for the existence of a data directory,
optionally create a new directory at the provided path location.
Usage
get_data_dir(
path = NULL,
cache = FALSE,
create = TRUE,
ask = TRUE,
appname = NULL,
pkg = NULL,
allow_null = TRUE,
quiet = FALSE,
recursive = TRUE,
call = caller_env()
)
list_path_filenames(
path,
fileext = NULL,
pattern = NULL,
full.names = TRUE,
call = caller_env(),
...
)
Arguments
- path
Path to directory for use as data directory.
- cache
If
TRUE
, and path isNULL
set path torappdirs::user_cache_dir()
(using value of pkg as appname). If path is notNULL
, the path is returned even if cache isTRUE
.- create
If
FALSE
and path does not exist, return path with a warning. IfTRUE
andrlang::is_interactive()
isTRUE
, ask user if directory should be created. If the session not interactive and create isTRUE
, a new directory will be created.- ask
If
TRUE
, create isFALSE
, and session is interactive, ask to create directory if the provided directory does not exist.- appname, pkg
pkg is used if appname is NULL. Passed to
rappdirs::user_cache_dir()
- allow_null
If
TRUE
, path isNULL
, cache isFALSE
, return theNULL
path value; defaults toTRUE
.- quiet
If
TRUE
, suppress informational messages.- recursive
logical. Should elements of the path other than the last be created? If true, like the Unix command
mkdir -p
.- call
The execution environment of a currently running function, e.g.
caller_env()
. The function will be mentioned in error messages as the source of the error. See thecall
argument ofabort()
for more information.- fileext
File extension. If supplied to
list_path_filenames()
and pattern isNULL
, only return file names matching this extension.- pattern
an optional regular expression. Only file names which match the regular expression will be returned.
- full.names
a logical value. If
TRUE
, the directory path is prepended to the file names to give a relative file path. IfFALSE
, the file names (rather than paths) are returned.- ...
Additional parameters passed to
list.files()
bylist_path_filenames()
.