dir.create2: Safe directory construction

View source: R/unlink2.R

dir.create2R Documentation

Safe directory construction

Description

Create a directory with an error message if it does not succeed.

Usage

dir.create2(path, recursive = TRUE, ...)

Arguments

path, recursive, ...

Further arguments to pass to dir.create.

Details

This is primarily necessary to avoid incomprehensible errors when a directory cannot be created, usually due to insufficient permissions. We set recursive=TRUE by default for convenience.

Note that the presence of an existing directory at path will cause this function to fail. This is usually desirable in the context of basilisk.utils as stale directories should be unlink2ed beforehand.

Value

Either path is created or an error is raised. NULL is invisibly returned.

See Also

unlink2, for a similarly safe deletion function.

Examples

out <- tempfile()
dir.create2(out)


LTLA/basilisk.utils documentation built on April 13, 2024, 1:14 a.m.