Fix directory_map() unit testing on Windows

See #2334 and #2475