You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-16 14:00:40 +00:00
Fix persistent favorites after rename
Signed-off-by: Daniel Kříž <Daniel.kriz@protonmail.com>
This commit is contained in:
@@ -1294,6 +1294,18 @@ void EditorFileDialog::_update_favorites() {
|
|||||||
favorite->set_pressed(false);
|
favorite->set_pressed(false);
|
||||||
|
|
||||||
Vector<String> favorited = EditorSettings::get_singleton()->get_favorites();
|
Vector<String> favorited = EditorSettings::get_singleton()->get_favorites();
|
||||||
|
|
||||||
|
bool fav_changed = false;
|
||||||
|
for (int i = favorited.size() - 1; i >= 0; i--) {
|
||||||
|
if (!dir_access->dir_exists(favorited[i])) {
|
||||||
|
favorited.remove_at(i);
|
||||||
|
fav_changed = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (fav_changed) {
|
||||||
|
EditorSettings::get_singleton()->set_favorites(favorited);
|
||||||
|
}
|
||||||
|
|
||||||
for (int i = 0; i < favorited.size(); i++) {
|
for (int i = 0; i < favorited.size(); i++) {
|
||||||
bool cres = favorited[i].begins_with("res://");
|
bool cres = favorited[i].begins_with("res://");
|
||||||
if (cres != res) {
|
if (cres != res) {
|
||||||
|
|||||||
@@ -224,6 +224,19 @@ void FileSystemDock::_update_tree(const Vector<String> &p_uncollapsed_paths, boo
|
|||||||
favorites->set_collapsed(p_uncollapsed_paths.find("Favorites") < 0);
|
favorites->set_collapsed(p_uncollapsed_paths.find("Favorites") < 0);
|
||||||
|
|
||||||
Vector<String> favorite_paths = EditorSettings::get_singleton()->get_favorites();
|
Vector<String> favorite_paths = EditorSettings::get_singleton()->get_favorites();
|
||||||
|
|
||||||
|
DirAccessRef da = DirAccess::create(DirAccess::ACCESS_RESOURCES);
|
||||||
|
bool fav_changed = false;
|
||||||
|
for (int i = favorite_paths.size() - 1; i >= 0; i--) {
|
||||||
|
if (!da->dir_exists(favorite_paths[i])) {
|
||||||
|
favorite_paths.remove_at(i);
|
||||||
|
fav_changed = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (fav_changed) {
|
||||||
|
EditorSettings::get_singleton()->set_favorites(favorite_paths);
|
||||||
|
}
|
||||||
|
|
||||||
for (int i = 0; i < favorite_paths.size(); i++) {
|
for (int i = 0; i < favorite_paths.size(); i++) {
|
||||||
String fave = favorite_paths[i];
|
String fave = favorite_paths[i];
|
||||||
if (!fave.begins_with("res://")) {
|
if (!fave.begins_with("res://")) {
|
||||||
|
|||||||
Reference in New Issue
Block a user