check if a file is a dir in a cross platform manner