| checkPathForOutput {checkmate} | R Documentation |
Check whether a file path can later be safely used to create a file and write to it.
This is checked:
Does dirname(x) exist?
Does no file under path x exist?
Is dirname(x) writeable?
Paths are relative to the current working directory.
checkPathForOutput(x, overwrite = FALSE) assertPathForOutput(x, overwrite = FALSE, .var.name) testPathForOutput(x, overwrite = FALSE)
x |
[any] |
overwrite |
[ |
.var.name |
[character(1)] |
Depending on the function prefix:
If the check is successful, all functions return TRUE.
If the check is not successful, assertPathForOutput throws an error message,
testPathForOutput returns FALSE and checkPathForOutput returns
a string with the error message.
Other filesystem: assertAccess,
checkAccess, testAccess;
assertDirectory,
checkDirectory,
testDirectory; assertFile,
checkFile, testFile
# Can we create a file in the tempdir? testPathForOutput(file.path(tempdir(), "process.log"))