Skip to content

Commit

Permalink
Merge pull request #93023 from akien-mga/revert-92650
Browse files Browse the repository at this point in the history
Revert "Fix FileSystem dock won't show any file folders"
  • Loading branch information
akien-mga authored Jun 11, 2024
2 parents 62a056a + e4fa854 commit 1a8c6e8
Show file tree
Hide file tree
Showing 10 changed files with 216 additions and 360 deletions.
8 changes: 5 additions & 3 deletions core/io/file_access.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
18 changes: 0 additions & 18 deletions core/io/resource_importer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 0 additions & 3 deletions core/io/resource_importer.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,6 @@ class ResourceFormatImporter : public ResourceFormatLoader {
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();
};

Expand Down
61 changes: 29 additions & 32 deletions core/io/resource_loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}
Expand Down
12 changes: 0 additions & 12 deletions doc/classes/EditorFileSystem.xml
Original file line number Diff line number Diff line change
Expand Up @@ -90,18 +90,6 @@
Emitted if at least one resource is reloaded when the filesystem is scanned.
</description>
</signal>
<signal name="scan_started">
<param index="0" name="complete_scan" type="bool" />
<description>
Emitted when a new scan of the project files has started.
</description>
</signal>
<signal name="scan_stopped">
<param index="0" name="complete_scan" type="bool" />
<description>
Emitted when a scan of the project files has ended.
</description>
</signal>
<signal name="script_classes_updated">
<description>
Emitted when the list of global script classes gets updated.
Expand Down
Loading

0 comments on commit 1a8c6e8

Please sign in to comment.