genfile() generates a file name only when the path given is a directory or the path isn't specified.