Skip to content

Commit dd09d5b

Browse files
committed
Merge pull request #110576 from Rindbee/fix-the-project-file-not-updated-when-some-file-removed
Fix the project file was not updated when some files were removed
2 parents ac65df5 + 54dff92 commit dd09d5b

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

editor/file_system/dependency_editor.cpp

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -575,6 +575,14 @@ void DependencyRemoveDialog::show(const Vector<String> &p_folders, const Vector<
575575
}
576576

577577
void DependencyRemoveDialog::ok_pressed() {
578+
HashMap<String, StringName> setting_path_map;
579+
for (const StringName &setting : path_project_settings) {
580+
const String path = ResourceUID::ensure_path(GLOBAL_GET(setting));
581+
setting_path_map[path] = setting;
582+
}
583+
584+
bool project_settings_modified = false;
585+
578586
for (const KeyValue<String, String> &E : all_remove_files) {
579587
String file = E.key;
580588

@@ -583,23 +591,17 @@ void DependencyRemoveDialog::ok_pressed() {
583591
emit_signal(SNAME("resource_removed"), res);
584592
res->set_path("");
585593
}
586-
}
587594

588-
HashMap<String, StringName> setting_path_map;
589-
for (const StringName &setting : path_project_settings) {
590-
const String path = ResourceUID::ensure_path(GLOBAL_GET(setting));
591-
setting_path_map[path] = setting;
592-
}
593-
594-
bool project_settings_modified = false;
595-
for (const String &file : files_to_delete) {
596595
// If the file we are deleting for e.g. the main scene, default environment,
597596
// or audio bus layout, we must clear its definition in Project Settings.
598597
const StringName *setting_name = setting_path_map.getptr(file);
599598
if (setting_name) {
600599
ProjectSettings::get_singleton()->set(*setting_name, "");
600+
project_settings_modified = true;
601601
}
602+
}
602603

604+
for (const String &file : files_to_delete) {
603605
const String path = OS::get_singleton()->get_resource_dir() + file.replace_first("res://", "/");
604606
print_verbose("Moving to trash: " + path);
605607
Error err = OS::get_singleton()->move_to_trash(path);

0 commit comments

Comments
 (0)