libglob: only return dirs for globs ending in /

`foo.txt/` should not return `foo.txt` if `foo.txt` is in fact a text
file and not a directory.