There are unexpected results with "." and "..", based on how fnamemodify() works. Add a conditional to handle these, and document this through unit tests.