Is there a single way of detecting if a directory/file/symlink/etc. entity (more generalized) exists?
I need a single function because I need to check an array of paths that could be directories, files or symlinks. I know File.exists?"file_path"
works for directories and files but not for symlinks (which is File.symlink?"symlink_path"
).
true
if the symlink exists, regardless of whether it can be ultimately resolved to a non-symlink. I.e. it should returntrue
for broken links as well.File.exists?
will only returntrue
for a symlink that's not broken. – Hogshead