Replace the code in fileExists() with a more generic version.

The old code just fopen()ed the given parameter, which apparently
doesn't work for directories, under Win32. So this should fix
the crash that happens there.