Fix a bug with auto-prefix on Windows.

On Unix, dirname('/x') returns /. But on Windows, it returns \. This
causes a very stupid bug which did not appear with /x/y because on Windows
returns, it returns /x. Yes.

Thanks @thehawk and @mathias-strasser!