Removed dependency on 3rd-part dirent.h

Switched to an all WINAPI method for the windows version.