Move cross-platform check into fs module