Skip to main content

path_present

Function path_present 

Source
pub fn path_present(path: &str) -> bool
Expand description

Is anything present at path — including a symlink whose target is missing?

Path::exists() follows symlinks and reports false for a dangling one, which makes a “don’t clobber what’s already there” check quietly wrong: a cert.pem symlinked to a target that is temporarily absent reads as “no file”, and the rename in [publish] then replaces the symlink itself with a regular file. symlink_metadata does not follow, so the link is seen. Anything other than “not found” — including a permissions error we cannot see through — counts as present, because the safe answer to “is something there?” is yes.