Skip to content

Commit

Permalink
Don't remove favorite files in EditorFileDialog
Browse files Browse the repository at this point in the history
  • Loading branch information
KoBeWi committed Oct 18, 2023
1 parent 30f2a6d commit 825a18e
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 825a18e

Please sign in to comment.