Fix up d_type handling - we need to include <dirent.h> before