mirror of
https://github.com/godotengine/godot.git
synced 2025-10-19 07:53:26 +00:00
Fix the project file was not updated when some files were removed
(cherry picked from commit 54dff9228c
)
This commit is contained in:
parent
e6cf63cb88
commit
3f97c33dac
1 changed files with 11 additions and 9 deletions
|
@ -575,6 +575,14 @@ void DependencyRemoveDialog::show(const Vector<String> &p_folders, const Vector<
|
|||
}
|
||||
|
||||
void DependencyRemoveDialog::ok_pressed() {
|
||||
HashMap<String, StringName> setting_path_map;
|
||||
for (const StringName &setting : path_project_settings) {
|
||||
const String path = ResourceUID::ensure_path(GLOBAL_GET(setting));
|
||||
setting_path_map[path] = setting;
|
||||
}
|
||||
|
||||
bool project_settings_modified = false;
|
||||
|
||||
for (const KeyValue<String, String> &E : all_remove_files) {
|
||||
String file = E.key;
|
||||
|
||||
|
@ -583,23 +591,17 @@ void DependencyRemoveDialog::ok_pressed() {
|
|||
emit_signal(SNAME("resource_removed"), res);
|
||||
res->set_path("");
|
||||
}
|
||||
}
|
||||
|
||||
HashMap<String, StringName> setting_path_map;
|
||||
for (const StringName &setting : path_project_settings) {
|
||||
const String path = ResourceUID::ensure_path(GLOBAL_GET(setting));
|
||||
setting_path_map[path] = setting;
|
||||
}
|
||||
|
||||
bool project_settings_modified = false;
|
||||
for (const String &file : files_to_delete) {
|
||||
// If the file we are deleting for e.g. the main scene, default environment,
|
||||
// or audio bus layout, we must clear its definition in Project Settings.
|
||||
const StringName *setting_name = setting_path_map.getptr(file);
|
||||
if (setting_name) {
|
||||
ProjectSettings::get_singleton()->set(*setting_name, "");
|
||||
project_settings_modified = true;
|
||||
}
|
||||
}
|
||||
|
||||
for (const String &file : files_to_delete) {
|
||||
const String path = OS::get_singleton()->get_resource_dir() + file.replace_first("res://", "/");
|
||||
print_verbose("Moving to trash: " + path);
|
||||
Error err = OS::get_singleton()->move_to_trash(path);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue