Make compileable for Windows

Use stat.h instead of dirent.h to check for directiories, dirent is missing a 'type' under Windows.