Handle weird edge case with is_dir() on a partial path containing file extensions