Is it possible to check for a symlink without raising an exception, even if the symling is dangling?
I think not, because: - file-exists? cannot be used to check, because it evaluates to #f in case of a dangling symlink. - file-info cannot be used to check, because it raises an exception, if there's nothing.
Here's an example:
(create-symbolic-link "/doesnotexist" "~/dangling") ;; worked, the symlink has been created.
(file-exists? "~/dangling") ;; evaluates to #f.
(create-symbolic-link "/anotherplace" "~/dangling") ;; ERROR: File exists.
(file-info "~/dangling") ;; ERROR: No such file or directory.
(file-info "~/dangling" #f) ;; Ok, informs about the symlink.
(delete-file "~/dangling") (file-info "~/dangling" #f) ;; ERROR: No such file or directory.
I think it would be nice, if file-exists? had also an optional parameter ``CHASE?'' like file-info has.
Regards Thomas