summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
authorThomas Winderweedle <42662863+twinderw@users.noreply.github.com>2018-10-30 22:54:20 -0400
committerRĂ©mi Verschelde <rverschelde@gmail.com>2018-12-06 16:28:27 +0100
commitf2e7a650c7c23a7ec5c9dbf43ef605885e26d60e (patch)
treedcc84cd8e676f10386fef3058b59ea63289fbb23 /editor
parent3f1bec5887f7f9f9f60fcab2c16b619d1ade4113 (diff)
Clear application/run/main_scene if that file is deleted
Fixes #22473
Diffstat (limited to 'editor')
-rw-r--r--editor/dependency_editor.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/editor/dependency_editor.cpp b/editor/dependency_editor.cpp
index 99b6955160..74f574ce1c 100644
--- a/editor/dependency_editor.cpp
+++ b/editor/dependency_editor.cpp
@@ -495,6 +495,12 @@ void DependencyRemoveDialog::ok_pressed() {
Resource *res = ResourceCache::get(files_to_delete[i]);
res->set_path("");
}
+
+ // If the file we are deleting is the main scene, clear its definition.
+ if (files_to_delete[i] == ProjectSettings::get_singleton()->get("application/run/main_scene")) {
+ ProjectSettings::get_singleton()->set("application/run/main_scene", "");
+ }
+
String path = OS::get_singleton()->get_resource_dir() + files_to_delete[i].replace_first("res://", "/");
print_verbose("Moving to trash: " + path);
Error err = OS::get_singleton()->move_to_trash(path);