core: Fail with a better error message when list_dir gets an empty path

(Yes, this did happen in real life...)
testsuite: Add a test for listing the root directory...

...and don't treat Path("/") like Path("").