* Pass absolute path to directoryExists
As pointed out by @gretzkiy, the `directoryExists` call added to
`matchFiles` in #44710 should have been passing the absolute path (since
the current directory might not match `currentDirectory`).
* Add test, simplify/clarify/fix matchFiles and friends
Co-authored-by: Andrew Branch <andrew@wheream.io>