From the path module doc:
If the path is empty, Base returns ".". If the path consists
entirely of slashes, Base returns "/".
Actually validate that we provide a filename when one is required,
rather than failing with an error that /scratch exists but is not a
file.
Signed-off-by: Daniel Stone <daniels@collabora.com>