Skip to content

Commit 261f0b9

Browse files
committed
Merge pull request #100409 from KoBeWi/now_delete_uids
Fix DependencyRemoveDialog not handling UIDs
2 parents 3936d11 + 7321c18 commit 261f0b9

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

editor/dependency_editor.cpp

+12-12
Original file line numberDiff line numberDiff line change
@@ -590,42 +590,42 @@ void DependencyRemoveDialog::ok_pressed() {
590590
}
591591

592592
bool project_settings_modified = false;
593-
for (int i = 0; i < files_to_delete.size(); ++i) {
593+
for (const String &file : files_to_delete) {
594594
// If the file we are deleting for e.g. the main scene, default environment,
595595
// or audio bus layout, we must clear its definition in Project Settings.
596-
if (files_to_delete[i] == String(GLOBAL_GET("application/config/icon"))) {
596+
if (file == ResourceUID::ensure_path(GLOBAL_GET("application/config/icon"))) {
597597
ProjectSettings::get_singleton()->set("application/config/icon", "");
598598
project_settings_modified = true;
599-
} else if (files_to_delete[i] == String(GLOBAL_GET("application/run/main_scene"))) {
599+
} else if (file == ResourceUID::ensure_path(GLOBAL_GET("application/run/main_scene"))) {
600600
ProjectSettings::get_singleton()->set("application/run/main_scene", "");
601601
project_settings_modified = true;
602-
} else if (files_to_delete[i] == String(GLOBAL_GET("application/boot_splash/image"))) {
602+
} else if (file == ResourceUID::ensure_path(GLOBAL_GET("application/boot_splash/image"))) {
603603
ProjectSettings::get_singleton()->set("application/boot_splash/image", "");
604604
project_settings_modified = true;
605-
} else if (files_to_delete[i] == String(GLOBAL_GET("rendering/environment/defaults/default_environment"))) {
605+
} else if (file == ResourceUID::ensure_path(GLOBAL_GET("rendering/environment/defaults/default_environment"))) {
606606
ProjectSettings::get_singleton()->set("rendering/environment/defaults/default_environment", "");
607607
project_settings_modified = true;
608-
} else if (files_to_delete[i] == String(GLOBAL_GET("display/mouse_cursor/custom_image"))) {
608+
} else if (file == ResourceUID::ensure_path(GLOBAL_GET("display/mouse_cursor/custom_image"))) {
609609
ProjectSettings::get_singleton()->set("display/mouse_cursor/custom_image", "");
610610
project_settings_modified = true;
611-
} else if (files_to_delete[i] == String(GLOBAL_GET("gui/theme/custom"))) {
611+
} else if (file == ResourceUID::ensure_path(GLOBAL_GET("gui/theme/custom"))) {
612612
ProjectSettings::get_singleton()->set("gui/theme/custom", "");
613613
project_settings_modified = true;
614-
} else if (files_to_delete[i] == String(GLOBAL_GET("gui/theme/custom_font"))) {
614+
} else if (file == ResourceUID::ensure_path(GLOBAL_GET("gui/theme/custom_font"))) {
615615
ProjectSettings::get_singleton()->set("gui/theme/custom_font", "");
616616
project_settings_modified = true;
617-
} else if (files_to_delete[i] == String(GLOBAL_GET("audio/buses/default_bus_layout"))) {
617+
} else if (file == ResourceUID::ensure_path(GLOBAL_GET("audio/buses/default_bus_layout"))) {
618618
ProjectSettings::get_singleton()->set("audio/buses/default_bus_layout", "");
619619
project_settings_modified = true;
620620
}
621621

622-
String path = OS::get_singleton()->get_resource_dir() + files_to_delete[i].replace_first("res://", "/");
622+
const String path = OS::get_singleton()->get_resource_dir() + file.replace_first("res://", "/");
623623
print_verbose("Moving to trash: " + path);
624624
Error err = OS::get_singleton()->move_to_trash(path);
625625
if (err != OK) {
626-
EditorNode::get_singleton()->add_io_error(TTR("Cannot remove:") + "\n" + files_to_delete[i] + "\n");
626+
EditorNode::get_singleton()->add_io_error(TTR("Cannot remove:") + "\n" + file + "\n");
627627
} else {
628-
emit_signal(SNAME("file_removed"), files_to_delete[i]);
628+
emit_signal(SNAME("file_removed"), file);
629629
}
630630
}
631631
if (project_settings_modified) {

0 commit comments

Comments
 (0)