summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
authorAndreas Haas <liu.gam3@gmail.com>2017-08-15 01:13:14 +0200
committerAndreas Haas <liu.gam3@gmail.com>2017-08-15 01:13:41 +0200
commit155402dc1b6b4e9113b0ffc737182ce1956efe97 (patch)
tree824ba2c7db0aeb4088ffb5b7d7568be59e802cc3 /editor
parent7fc3c51169957f0907a13dd07d4004496e6ebd56 (diff)
Removing a Resource also deletes imported files.
Diffstat (limited to 'editor')
-rw-r--r--editor/editor_file_system.cpp15
-rw-r--r--editor/editor_file_system.h2
2 files changed, 17 insertions, 0 deletions
diff --git a/editor/editor_file_system.cpp b/editor/editor_file_system.cpp
index eeb2f5ae8a..8428c751a3 100644
--- a/editor/editor_file_system.cpp
+++ b/editor/editor_file_system.cpp
@@ -339,6 +339,7 @@ bool EditorFileSystem::_update_scan_actions() {
int idx = ia.dir->find_file_index(ia.file);
ERR_CONTINUE(idx == -1);
+ _delete_internal_files(ia.dir->files[idx]->file);
memdelete(ia.dir->files[idx]);
ia.dir->files.remove(idx);
@@ -832,6 +833,19 @@ void EditorFileSystem::_scan_fs_changes(EditorFileSystemDirectory *p_dir, const
}
}
+void EditorFileSystem::_delete_internal_files(String p_file) {
+ if (FileAccess::exists(p_file + ".import")) {
+ List<String> paths;
+ ResourceFormatImporter::get_singleton()->get_internal_resource_path_list(p_file, &paths);
+ DirAccess *da = DirAccess::create(DirAccess::ACCESS_RESOURCES);
+ for (List<String>::Element *E = paths.front(); E; E = E->next()) {
+ da->remove(E->get());
+ }
+ da->remove(p_file + ".import");
+ memdelete(da);
+ }
+}
+
void EditorFileSystem::_thread_func_sources(void *_userdata) {
EditorFileSystem *efs = (EditorFileSystem *)_userdata;
@@ -1186,6 +1200,7 @@ void EditorFileSystem::update_file(const String &p_file) {
if (!FileAccess::exists(p_file)) {
//was removed
+ _delete_internal_files(p_file);
memdelete(fs->files[cpos]);
fs->files.remove(cpos);
call_deferred("emit_signal", "filesystem_changed"); //update later
diff --git a/editor/editor_file_system.h b/editor/editor_file_system.h
index 3522a1ab1d..f98758fd03 100644
--- a/editor/editor_file_system.h
+++ b/editor/editor_file_system.h
@@ -168,6 +168,8 @@ class EditorFileSystem : public Node {
void _scan_fs_changes(EditorFileSystemDirectory *p_dir, const ScanProgress &p_progress);
+ void _delete_internal_files(String p_file);
+
Set<String> valid_extensions;
Set<String> import_extensions;