The argument can either be a file, a dir or a regexp

When the argument is a file the file itself is used.
When the argument is a directory the latest file
just in this directory (not recursive) is used.
Else the argument is expected to be a regexp to find
multiple files. Then also the latest of these files is used.