Skip to content

Commit

Permalink
Merge pull request #82537 from KoBeWi/the_files_are_back_on_the_menu
Browse files Browse the repository at this point in the history
Don't remove favorite files in EditorFileDialog
  • Loading branch information
akien-mga committed Oct 18, 2023
2 parents f7da96a + 825a18e commit 7f884b4
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions editor/gui/editor_file_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1393,37 +1393,36 @@ void EditorFileDialog::_update_favorites() {
bool fav_changed = false;
int current_favorite = -1;
for (int i = 0; i < favorited.size(); i++) {
bool cres = favorited[i].begins_with("res://");
if (cres != res) {
String name = favorited[i];

bool cres = name.begins_with("res://");
if (cres != res || !name.ends_with("/")) {
continue;
}

if (!dir_access->dir_exists(favorited[i])) {
if (!dir_access->dir_exists(name)) {
// Remove invalid directory from the list of Favorited directories.
favorited.remove_at(i--);
fav_changed = true;
continue;
}

// Compute favorite display text.
String name = favorited[i];
if (res && name == "res://") {
if (name == current) {
current_favorite = favorited_paths.size();
}
name = "/";
favorited_paths.append(favorited[i]);
favorited_names.append(name);
} else if (name.ends_with("/")) {
} else {
if (name == current || name == current + "/") {
current_favorite = favorited_paths.size();
}
name = name.substr(0, name.length() - 1);
name = name.get_file();
favorited_paths.append(favorited[i]);
favorited_names.append(name);
} else {
// Ignore favorited files.
}
}

Expand Down

0 comments on commit 7f884b4

Please sign in to comment.