Add check to mkdirs(path) to see if path is a link to broken file/directory, e.g.
> mkdirs.default
function (pathname, ...)
{
if (length(pathname) == 0L)
return(TRUE)
pathname <- as.character(pathname)
if (isFile(pathname) || isDirectory(pathname))
return(FALSE)
## If neither a file nor a directory, then it could be a
## link to a broken file/directory. If so, fail.
if (isLink(pathname)) return(FALSE)
parent <- getParent(pathname)
if (identical(parent, pathname))
throw("Could not get parent directory: ", pathname)
if (isFile(parent))
return(FALSE)
if (!isDirectory(parent)) {
if (!mkdirs(parent))
return(FALSE)
}
if (!isDirectory(pathname)) {
res <- dir.create(pathname)
if (!res) {
pathname <- getRelativePath(pathname)
res <- dir.create(pathname)
}
return(res)
}
TRUE
}
Add check to
mkdirs(path)
to see ifpath
is a link to broken file/directory, e.g.where