summaryrefslogtreecommitdiff
path: root/editor/editor_file_system.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2021-06-09 10:47:32 +0200
committerRémi Verschelde <rverschelde@gmail.com>2021-06-14 19:56:20 +0200
commit1074017f043ec9155b12ea97cd00cf11361ccdf0 (patch)
treed286027835b2e02b89782b4f9a31a407d6b5651f /editor/editor_file_system.cpp
parent16027e7cf412140c128e7c002ce0be533b94db00 (diff)
Refactor editor paths validation in EditorPaths and EditorSettings
- EditorSettings: Ensure that `create()` makes a valid singleton. Fixes #49179, fixes #49450. - EditorPaths: Cleanup code, properly set `paths_valid`. - EditorPaths: Move more paths validation (check, mkdir) from EditorSettings for a better separation of concerns. - EditorPaths: Move EditorFileSystem creation of `.godot/imported` next to other paths.
Diffstat (limited to 'editor/editor_file_system.cpp')
-rw-r--r--editor/editor_file_system.cpp19
1 files changed, 1 insertions, 18 deletions
diff --git a/editor/editor_file_system.cpp b/editor/editor_file_system.cpp
index 050e55c624..c61b097ccd 100644
--- a/editor/editor_file_system.cpp
+++ b/editor/editor_file_system.cpp
@@ -1934,19 +1934,6 @@ void EditorFileSystem::_reimport_thread(uint32_t p_index, ImportThreadData *p_im
}
void EditorFileSystem::reimport_files(const Vector<String> &p_files) {
- {
- // Ensure that ProjectSettings::IMPORTED_FILES_PATH exists.
- DirAccess *da = DirAccess::open("res://");
- if (da->change_dir(ProjectSettings::IMPORTED_FILES_PATH) != OK) {
- Error err = da->make_dir_recursive(ProjectSettings::IMPORTED_FILES_PATH);
- if (err || da->change_dir(ProjectSettings::IMPORTED_FILES_PATH) != OK) {
- memdelete(da);
- ERR_FAIL_MSG("Failed to create '" + ProjectSettings::IMPORTED_FILES_PATH + "' folder.");
- }
- }
- memdelete(da);
- }
-
importing = true;
EditorProgress pr("reimport", TTR("(Re)Importing Assets"), p_files.size());
@@ -2177,13 +2164,9 @@ EditorFileSystem::EditorFileSystem() {
scanning_changes = false;
scanning_changes_done = false;
- DirAccess *da = DirAccess::create(DirAccess::ACCESS_RESOURCES);
- if (da->change_dir(ProjectSettings::IMPORTED_FILES_PATH) != OK) {
- da->make_dir(ProjectSettings::IMPORTED_FILES_PATH);
- }
// This should probably also work on Unix and use the string it returns for FAT32 or exFAT
+ DirAccessRef da = DirAccess::create(DirAccess::ACCESS_RESOURCES);
using_fat32_or_exfat = (da->get_filesystem_type() == "FAT32" || da->get_filesystem_type() == "exFAT");
- memdelete(da);
scan_total = 0;
update_script_classes_queued.clear();