Skip to content

Commit 7f884b4

Browse files
committed
Merge pull request #82537 from KoBeWi/the_files_are_back_on_the_menu
Don't remove favorite files in EditorFileDialog
2 parents f7da96a + 825a18e commit 7f884b4

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

editor/gui/editor_file_dialog.cpp

+6-7
Original file line numberDiff line numberDiff line change
@@ -1393,37 +1393,36 @@ void EditorFileDialog::_update_favorites() {
13931393
bool fav_changed = false;
13941394
int current_favorite = -1;
13951395
for (int i = 0; i < favorited.size(); i++) {
1396-
bool cres = favorited[i].begins_with("res://");
1397-
if (cres != res) {
1396+
String name = favorited[i];
1397+
1398+
bool cres = name.begins_with("res://");
1399+
if (cres != res || !name.ends_with("/")) {
13981400
continue;
13991401
}
14001402

1401-
if (!dir_access->dir_exists(favorited[i])) {
1403+
if (!dir_access->dir_exists(name)) {
14021404
// Remove invalid directory from the list of Favorited directories.
14031405
favorited.remove_at(i--);
14041406
fav_changed = true;
14051407
continue;
14061408
}
14071409

14081410
// Compute favorite display text.
1409-
String name = favorited[i];
14101411
if (res && name == "res://") {
14111412
if (name == current) {
14121413
current_favorite = favorited_paths.size();
14131414
}
14141415
name = "/";
14151416
favorited_paths.append(favorited[i]);
14161417
favorited_names.append(name);
1417-
} else if (name.ends_with("/")) {
1418+
} else {
14181419
if (name == current || name == current + "/") {
14191420
current_favorite = favorited_paths.size();
14201421
}
14211422
name = name.substr(0, name.length() - 1);
14221423
name = name.get_file();
14231424
favorited_paths.append(favorited[i]);
14241425
favorited_names.append(name);
1425-
} else {
1426-
// Ignore favorited files.
14271426
}
14281427
}
14291428

0 commit comments

Comments
 (0)