summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
authorMarcin Zawiejski <dragmz@gmail.com>2018-05-11 21:37:08 +0200
committerMarcin Zawiejski <dragmz@gmail.com>2018-05-11 21:37:08 +0200
commit9ecc26ce598dc081063340de3fe1ea8d5d57eba3 (patch)
treec90cdfaf1f823148aa13d3e91455e18ae21f0361 /editor
parent0902915c33883e5fcb39287e4bc82826497d233b (diff)
fix for removing files
Diffstat (limited to 'editor')
-rw-r--r--editor/dependency_editor.cpp26
1 files changed, 13 insertions, 13 deletions
diff --git a/editor/dependency_editor.cpp b/editor/dependency_editor.cpp
index 953d787322..c4a17d5402 100644
--- a/editor/dependency_editor.cpp
+++ b/editor/dependency_editor.cpp
@@ -504,25 +504,25 @@ void DependencyRemoveDialog::show(const Vector<String> &p_folders, const Vector<
void DependencyRemoveDialog::ok_pressed() {
+ for (int i = 0; i < files_to_delete.size(); ++i) {
+ if (ResourceCache::has(files_to_delete[i])) {
+ Resource *res = ResourceCache::get(files_to_delete[i]);
+ res->set_path("");
+ }
+ String path = OS::get_singleton()->get_resource_dir() + files_to_delete[i].replace_first("res://", "/");
+ print_line("Moving to trash: " + path);
+ Error err = OS::get_singleton()->move_to_trash(path);
+ if (err != OK) {
+ EditorNode::get_singleton()->add_io_error(TTR("Cannot remove:") + "\n" + files_to_delete[i] + "\n");
+ }
+ }
+
if (dirs_to_delete.size() == 0) {
//If we only deleted files we should only need to tell the file system about the files we touched.
for (int i = 0; i < files_to_delete.size(); ++i)
EditorFileSystem::get_singleton()->update_file(files_to_delete[i]);
} else {
- for (int i = 0; i < files_to_delete.size(); ++i) {
- if (ResourceCache::has(files_to_delete[i])) {
- Resource *res = ResourceCache::get(files_to_delete[i]);
- res->set_path("");
- }
- String path = OS::get_singleton()->get_resource_dir() + files_to_delete[i].replace_first("res://", "/");
- print_line("Moving to trash: " + path);
- Error err = OS::get_singleton()->move_to_trash(path);
- if (err != OK) {
- EditorNode::get_singleton()->add_io_error(TTR("Cannot remove:") + "\n" + files_to_delete[i] + "\n");
- }
- }
-
for (int i = 0; i < dirs_to_delete.size(); ++i) {
String path = OS::get_singleton()->get_resource_dir() + dirs_to_delete[i].replace_first("res://", "/");
print_line("Moving to trash: " + path);