Work around problems with inexplicable dirname on Windows