### Godot version

v4.2.dev4.mono.official [549fcce5f]

### System information

window10 64bit

### Issue description

![GIF 2023-9-1 22-39-07](https://github.com/godotengine/godot/assets/35988767/d7be4a45-f5f0-4408-8758-f4bf9f3c9c5d)


### Steps to reproduce

/

### Minimal reproduction project

/
if (cres != res) {
			continue;
		}
		if (!dir_access->dir_exists(recentd[i])) {
			
			recentd.remove_at(i--);
			continue;
		}
		
		String name = recentd[i];
		if (res && name == "res://") {
			name = "/";
		} else {
			if (name.ends_with("/")) {
				name = name.substr(0, name.length() - 1);
			}
			name = name.get_file();
		}
		recentd_paths.append(recentd[i]);
		recentd_names.append(name);
	}
	EditorNode::disambiguate_filenames(recentd_paths, recentd_names);
	for (int i = 0; i < recentd_paths.size(); i++) {
		recent->add_item(recentd_names[i], theme_cache.folder);
		recent->set_item_metadata(-1, recentd_paths[i]);
		recent->set_item_icon_modulate(-1, theme_cache.folder_icon_color);
	}
	EditorSettings::get_singleton()->set_recent_dirs(recentd);
}
void EditorFileDialog::_recent_selected(int p_idx) {