Skip to content

Commit

Permalink
Merge pull request #89301 from KoBeWi/human_readable_code
Browse files Browse the repository at this point in the history
Refactor how file cache entries are stored
  • Loading branch information
akien-mga committed Mar 8, 2024
2 parents e9ca51c + 25553d7 commit bfa866c
Showing 1 changed file with 18 additions and 14 deletions.
32 changes: 18 additions & 14 deletions editor/editor_file_system.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand Down

0 comments on commit bfa866c

Please sign in to comment.