@@ -1393,37 +1393,36 @@ void EditorFileDialog::_update_favorites() {
1393
1393
bool fav_changed = false ;
1394
1394
int current_favorite = -1 ;
1395
1395
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 (" /" )) {
1398
1400
continue ;
1399
1401
}
1400
1402
1401
- if (!dir_access->dir_exists (favorited[i] )) {
1403
+ if (!dir_access->dir_exists (name )) {
1402
1404
// Remove invalid directory from the list of Favorited directories.
1403
1405
favorited.remove_at (i--);
1404
1406
fav_changed = true ;
1405
1407
continue ;
1406
1408
}
1407
1409
1408
1410
// Compute favorite display text.
1409
- String name = favorited[i];
1410
1411
if (res && name == " res://" ) {
1411
1412
if (name == current) {
1412
1413
current_favorite = favorited_paths.size ();
1413
1414
}
1414
1415
name = " /" ;
1415
1416
favorited_paths.append (favorited[i]);
1416
1417
favorited_names.append (name);
1417
- } else if (name. ends_with ( " / " )) {
1418
+ } else {
1418
1419
if (name == current || name == current + " /" ) {
1419
1420
current_favorite = favorited_paths.size ();
1420
1421
}
1421
1422
name = name.substr (0 , name.length () - 1 );
1422
1423
name = name.get_file ();
1423
1424
favorited_paths.append (favorited[i]);
1424
1425
favorited_names.append (name);
1425
- } else {
1426
- // Ignore favorited files.
1427
1426
}
1428
1427
}
1429
1428
0 commit comments