summaryrefslogtreecommitdiff
path: root/editor/editor_file_system.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/editor_file_system.cpp')
-rw-r--r--editor/editor_file_system.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/editor/editor_file_system.cpp b/editor/editor_file_system.cpp
index eeb2f5ae8a..2f4ac02703 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);
@@ -598,6 +599,10 @@ void EditorFileSystem::_scan_new_dir(EditorFileSystemDirectory *p_dir, DirAccess
fi->type = fc->type;
fi->modified_time = fc->modification_time;
fi->import_modified_time = fc->import_modification_time;
+ if (fc->type == String()) {
+ fi->type = ResourceLoader::get_resource_type(path);
+ //there is also the chance that file type changed due to reimport, must probably check this somehow here (or kind of note it for next time in another file?)
+ }
} else {
@@ -615,6 +620,7 @@ void EditorFileSystem::_scan_new_dir(EditorFileSystemDirectory *p_dir, DirAccess
}
fi->type = ResourceFormatImporter::get_singleton()->get_resource_type(path);
+ print_line("import extension tried resource type for " + path + " and its " + fi->type);
fi->modified_time = 0;
fi->import_modified_time = 0;
@@ -633,6 +639,7 @@ void EditorFileSystem::_scan_new_dir(EditorFileSystemDirectory *p_dir, DirAccess
fi->import_modified_time = 0;
} else {
fi->type = ResourceLoader::get_resource_type(path);
+ print_line("regular import tried resource type for " + path + " and its " + fi->type);
fi->modified_time = mt;
fi->import_modified_time = 0;
}
@@ -832,6 +839,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 +1206,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