1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00

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.
This commit is contained in:
Rémi Verschelde
2021-06-09 10:47:32 +02:00
parent 16027e7cf4
commit 1074017f04
8 changed files with 142 additions and 164 deletions

View File

@@ -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();