Fix empty basename.

If the basename of a file is empty, skip it.