Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix folder color not cleared for removed subfolders #90829

Merged
merged 1 commit into from
Apr 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions editor/filesystem_dock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@
#include "scene/gui/label.h"
#include "scene/gui/line_edit.h"
#include "scene/gui/progress_bar.h"
#include "scene/gui/texture_rect.h"
#include "scene/main/window.h"
#include "scene/resources/packed_scene.h"
#include "servers/display_server.h"

Expand Down Expand Up @@ -1778,8 +1776,19 @@ void FileSystemDock::_folder_removed(const String &p_folder) {
current_path = current_path.get_base_dir();
}

if (assigned_folder_colors.has(p_folder)) {
assigned_folder_colors.erase(p_folder);
// Remove assigned folder color for all subfolders.
bool folder_colors_updated = false;
List<Variant> paths;
assigned_folder_colors.get_key_list(&paths);
for (const Variant &E : paths) {
const String &path = E;
// These folder paths are guaranteed to end with a "/".
if (path.begins_with(p_folder)) {
assigned_folder_colors.erase(path);
folder_colors_updated = true;
}
}
if (folder_colors_updated) {
_update_folder_colors_setting();
}

Expand Down
Loading