You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-07 12:30:27 +00:00
Merge pull request #93372 from KoBeWi/instant_folders,_like_instant_noodles,_but_for_storing_files
Don't rescan filesystem when adding new directory
This commit is contained in:
@@ -3057,6 +3057,35 @@ void EditorFileSystem::move_group_file(const String &p_path, const String &p_new
|
||||
}
|
||||
}
|
||||
|
||||
void EditorFileSystem::add_new_directory(const String &p_path) {
|
||||
String path = p_path.get_base_dir();
|
||||
EditorFileSystemDirectory *parent = filesystem;
|
||||
int base = p_path.count("/");
|
||||
int max_bit = base + 1;
|
||||
|
||||
while (path != "res://") {
|
||||
EditorFileSystemDirectory *dir = get_filesystem_path(path);
|
||||
if (dir) {
|
||||
parent = dir;
|
||||
break;
|
||||
}
|
||||
path = path.get_base_dir();
|
||||
base--;
|
||||
}
|
||||
|
||||
for (int i = base; i < max_bit; i++) {
|
||||
EditorFileSystemDirectory *efd = memnew(EditorFileSystemDirectory);
|
||||
efd->parent = parent;
|
||||
efd->name = p_path.get_slice("/", i);
|
||||
parent->subdirs.push_back(efd);
|
||||
|
||||
if (i == base) {
|
||||
parent->subdirs.sort_custom<DirectoryComparator>();
|
||||
}
|
||||
parent = efd;
|
||||
}
|
||||
}
|
||||
|
||||
ResourceUID::ID EditorFileSystem::_resource_saver_get_resource_id_for_path(const String &p_path, bool p_generate) {
|
||||
if (!p_path.is_resource_file() || p_path.begins_with(ProjectSettings::get_singleton()->get_project_data_path())) {
|
||||
// Saved externally (configuration file) or internal file, do not assign an ID.
|
||||
|
||||
Reference in New Issue
Block a user