Merge pull request #89301 from KoBeWi/human_readable_code

Refactor how file cache entries are stored
This commit is contained in:
Rémi Verschelde 2024-03-09 00:52:39 +01:00
commit bfa866c318
No known key found for this signature in database
GPG Key ID: C3336907360768E1

View File

@ -1333,24 +1333,28 @@ void EditorFileSystem::_save_filesystem_cache(EditorFileSystemDirectory *p_dir,
p_file->store_line("::" + p_dir->get_path() + "::" + String::num(p_dir->modified_time));
for (int i = 0; i < p_dir->files.size(); i++) {
if (!p_dir->files[i]->import_group_file.is_empty()) {
group_file_cache.insert(p_dir->files[i]->import_group_file);
const EditorFileSystemDirectory::FileInfo *file_info = p_dir->files[i];
if (!file_info->import_group_file.is_empty()) {
group_file_cache.insert(file_info->import_group_file);
}
String type = p_dir->files[i]->type;
if (p_dir->files[i]->resource_script_class) {
type += "/" + String(p_dir->files[i]->resource_script_class);
}
String s = p_dir->files[i]->file + "::" + type + "::" + itos(p_dir->files[i]->uid) + "::" + itos(p_dir->files[i]->modified_time) + "::" + itos(p_dir->files[i]->import_modified_time) + "::" + itos(p_dir->files[i]->import_valid) + "::" + p_dir->files[i]->import_group_file + "::" + p_dir->files[i]->script_class_name + "<>" + p_dir->files[i]->script_class_extends + "<>" + p_dir->files[i]->script_class_icon_path;
s += "::";
for (int j = 0; j < p_dir->files[i]->deps.size(); j++) {
if (j > 0) {
s += "<>";
}
s += p_dir->files[i]->deps[j];
String type = file_info->type;
if (file_info->resource_script_class) {
type += "/" + String(file_info->resource_script_class);
}
p_file->store_line(s);
PackedStringArray cache_string;
cache_string.append(file_info->file);
cache_string.append(type);
cache_string.append(itos(file_info->uid));
cache_string.append(itos(file_info->modified_time));
cache_string.append(itos(file_info->import_modified_time));
cache_string.append(itos(file_info->import_valid));
cache_string.append(file_info->import_group_file);
cache_string.append(String("<>").join({ file_info->script_class_name, file_info->script_class_extends, file_info->script_class_icon_path }));
cache_string.append(String("<>").join(file_info->deps));
p_file->store_line(String("::").join(cache_string));
}
for (int i = 0; i < p_dir->subdirs.size(); i++) {