diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2024-06-11 11:46:35 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2024-06-11 11:46:35 +0200 |
commit | e4fa8543ea11b7d25c24c81c4a0b824b60fb82ec (patch) | |
tree | 1cb028256f8c3dbb92ea9ea4c7af73d1c363d451 /core | |
parent | 62a056aa56ca4471c035e43741c88e4a22d81802 (diff) | |
download | redot-engine-e4fa8543ea11b7d25c24c81c4a0b824b60fb82ec.tar.gz |
Revert "Fix FileSystem dock won't show any file folders"
This reverts commit 72856d633a6be5c596d4a3231acab009828a2efe.
Fixes #93022.
Diffstat (limited to 'core')
-rw-r--r-- | core/io/file_access.cpp | 8 | ||||
-rw-r--r-- | core/io/resource_importer.cpp | 18 | ||||
-rw-r--r-- | core/io/resource_importer.h | 3 | ||||
-rw-r--r-- | core/io/resource_loader.cpp | 61 |
4 files changed, 34 insertions, 56 deletions
diff --git a/core/io/file_access.cpp b/core/io/file_access.cpp index a762e24ff3..1cf388b33a 100644 --- a/core/io/file_access.cpp +++ b/core/io/file_access.cpp @@ -59,9 +59,11 @@ bool FileAccess::exists(const String &p_name) { return true; } - // Using file_exists because it's faster then trying to open the file. - Ref<FileAccess> ret = create_for_path(p_name); - return ret->file_exists(p_name); + Ref<FileAccess> f = open(p_name, READ); + if (f.is_null()) { + return false; + } + return true; } void FileAccess::_set_access_type(AccessType p_access) { diff --git a/core/io/resource_importer.cpp b/core/io/resource_importer.cpp index 49ba7b0358..fcf4a727ca 100644 --- a/core/io/resource_importer.cpp +++ b/core/io/resource_importer.cpp @@ -362,24 +362,6 @@ Variant ResourceFormatImporter::get_resource_metadata(const String &p_path) cons return pat.metadata; } - -Error ResourceFormatImporter::get_resource_import_info(const String &p_path, StringName &r_type, ResourceUID::ID &r_uid, String &r_import_group_file) const { - PathAndType pat; - Error err = _get_path_and_type(p_path, pat); - - if (err == OK) { - r_type = pat.type; - r_uid = pat.uid; - r_import_group_file = pat.group_file; - } else { - r_type = ""; - r_uid = ResourceUID::INVALID_ID; - r_import_group_file = ""; - } - - return err; -} - void ResourceFormatImporter::get_classes_used(const String &p_path, HashSet<StringName> *r_classes) { PathAndType pat; Error err = _get_path_and_type(p_path, pat); diff --git a/core/io/resource_importer.h b/core/io/resource_importer.h index 4a38a7fb4a..dbd9e70d16 100644 --- a/core/io/resource_importer.h +++ b/core/io/resource_importer.h @@ -93,9 +93,6 @@ public: String get_import_settings_hash() const; String get_import_base_path(const String &p_for_file) const; - - Error get_resource_import_info(const String &p_path, StringName &r_type, ResourceUID::ID &r_uid, String &r_import_group_file) const; - ResourceFormatImporter(); }; diff --git a/core/io/resource_loader.cpp b/core/io/resource_loader.cpp index 7299631fec..c3c37aa89d 100644 --- a/core/io/resource_loader.cpp +++ b/core/io/resource_loader.cpp @@ -957,39 +957,36 @@ String ResourceLoader::_path_remap(const String &p_path, bool *r_translation_rem new_path = path_remaps[new_path]; } else { // Try file remap. - // Usually, there's no remap file and FileAccess::exists() is faster then FileAccess::open(). - if (FileAccess::exists(new_path + ".remap")) { - Error err; - Ref<FileAccess> f = FileAccess::open(new_path + ".remap", FileAccess::READ, &err); - if (f.is_valid()) { - VariantParser::StreamFile stream; - stream.f = f; - - String assign; - Variant value; - VariantParser::Tag next_tag; - - int lines = 0; - String error_text; - while (true) { - assign = Variant(); - next_tag.fields.clear(); - next_tag.name = String(); - - err = VariantParser::parse_tag_assign_eof(&stream, lines, error_text, next_tag, assign, value, nullptr, true); - if (err == ERR_FILE_EOF) { - break; - } else if (err != OK) { - ERR_PRINT("Parse error: " + p_path + ".remap:" + itos(lines) + " error: " + error_text + "."); - break; - } + Error err; + Ref<FileAccess> f = FileAccess::open(new_path + ".remap", FileAccess::READ, &err); + if (f.is_valid()) { + VariantParser::StreamFile stream; + stream.f = f; + + String assign; + Variant value; + VariantParser::Tag next_tag; + + int lines = 0; + String error_text; + while (true) { + assign = Variant(); + next_tag.fields.clear(); + next_tag.name = String(); + + err = VariantParser::parse_tag_assign_eof(&stream, lines, error_text, next_tag, assign, value, nullptr, true); + if (err == ERR_FILE_EOF) { + break; + } else if (err != OK) { + ERR_PRINT("Parse error: " + p_path + ".remap:" + itos(lines) + " error: " + error_text + "."); + break; + } - if (assign == "path") { - new_path = value; - break; - } else if (next_tag.name != "remap") { - break; - } + if (assign == "path") { + new_path = value; + break; + } else if (next_tag.name != "remap") { + break; } } } |