File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -769,19 +769,26 @@ void EditorFileDialog::update_file_name() {
769769
770770// TODO: Could use a unit test.
771771Color EditorFileDialog::get_dir_icon_color (const String &p_dir_path) {
772+ if (!FileSystemDock::get_singleton ()) { // This dialog can be called from the project manager.
773+ return theme_cache.folder_icon_color ;
774+ }
775+
772776 const HashMap<String, Color> &folder_colors = FileSystemDock::get_singleton ()->get_folder_colors ();
773777 Dictionary assigned_folder_colors = FileSystemDock::get_singleton ()->get_assigned_folder_colors ();
774778
775779 Color folder_icon_color = theme_cache.folder_icon_color ;
776780
777781 // Check for a folder color to inherit (if one is assigned).
778- String parent_dir = p_dir_path;
779- while (parent_dir != " res://" && folder_icon_color == theme_cache. folder_icon_color ) {
782+ String parent_dir = ProjectSettings::get_singleton ()-> localize_path ( p_dir_path) ;
783+ while (! parent_dir. is_empty () && parent_dir != " res://" ) {
780784 if (!parent_dir.ends_with (" /" )) {
781785 parent_dir += " /" ;
782786 }
783787 if (assigned_folder_colors.has (parent_dir)) {
784788 folder_icon_color = folder_colors[assigned_folder_colors[parent_dir]];
789+ if (folder_icon_color != theme_cache.folder_icon_color ) {
790+ break ;
791+ }
785792 }
786793 parent_dir = parent_dir.trim_suffix (" /" ).get_base_dir ();
787794 }
You can’t perform that action at this time.
0 commit comments