From aca5cfc91346371a60e42476af52a3a9fa6afde2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20J=2E=20Est=C3=A9banez?= Date: Wed, 8 Jan 2025 13:43:17 +0100 Subject: [PATCH] Rationalize parsing of file system cache --- editor/editor_file_system.cpp | 32 +++++++++++--------------------- 1 file changed, 11 insertions(+), 21 deletions(-) diff --git a/editor/editor_file_system.cpp b/editor/editor_file_system.cpp index b8ce3ff65b..cd9c5048f3 100644 --- a/editor/editor_file_system.cpp +++ b/editor/editor_file_system.cpp @@ -383,33 +383,23 @@ void EditorFileSystem::_scan_filesystem() { name = cpath.path_join(name); FileCache fc; - fc.type = split[1]; - if (fc.type.contains_char('/')) { - fc.type = split[1].get_slice("/", 0); - fc.resource_script_class = split[1].get_slice("/", 1); - } + fc.type = split[1].get_slice("/", 0); + fc.resource_script_class = split[1].get_slice("/", 1); fc.uid = split[2].to_int(); fc.modification_time = split[3].to_int(); fc.import_modification_time = split[4].to_int(); fc.import_valid = split[5].to_int() != 0; fc.import_group_file = split[6].strip_edges(); - fc.script_class_name = split[7].get_slice("<>", 0); - fc.script_class_extends = split[7].get_slice("<>", 1); - fc.script_class_icon_path = split[7].get_slice("<>", 2); - fc.import_md5 = split[7].get_slice("<>", 3); - String dest_paths = split[7].get_slice("<>", 4); - if (!dest_paths.is_empty()) { - fc.import_dest_paths = dest_paths.split("<*>"); - } - - String deps = split[8].strip_edges(); - if (deps.length()) { - Vector dp = deps.split("<>"); - for (int i = 0; i < dp.size(); i++) { - const String &path = dp[i]; - fc.deps.push_back(path); - } + { + const Vector &slices = split[7].split("<>"); + ERR_CONTINUE(slices.size() < 5); + fc.script_class_name = slices[0]; + fc.script_class_extends = slices[1]; + fc.script_class_icon_path = slices[2]; + fc.import_md5 = slices[3]; + fc.import_dest_paths = slices[4].split("<*>"); } + fc.deps = split[8].strip_edges().split("<>"); file_cache[name] = fc; }