Make sure a directory exists, or create it
dir_path_create(...)
dir_path_check(...)
file_path_check(...)
The successive folders that make the path.
A path object is returned invisibly.
dir_path_check()
: Check that a directory exists.
file_path_check()
: Check that a file exists.
test_path <- dir_path_create(tempdir(), "dir_path_create_test", "subfolder")
test_path
#> /tmp/RtmpdegxSM/dir_path_create_test/subfolder
dir.exists(test_path) # Should be TRUE
#> [1] TRUE
dir_path_check(test_path) # Return the path only if it exists
# Remove
unlink(test_path)
unlink(dirname(test_path))