Skip to content

Commit

Permalink
Merge pull request #77276 from RandomShaper/avoid_first_import_error_…
Browse files Browse the repository at this point in the history
…spam

Avoid error spam on first opening of a not yet imported project
  • Loading branch information
akien-mga committed May 22, 2023
2 parents 5d16efa + ed9dc79 commit 6a3095a
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions editor/editor_file_system.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1506,6 +1506,16 @@ void EditorFileSystem::_save_late_updated_files() {
}

Vector<String> EditorFileSystem::_get_dependencies(const String &p_path) {
// Avoid error spam on first opening of a not yet imported project by treating the following situation
// as a benign one, not letting the file open error happen: the resource is of an importable type but
// it has not been imported yet.
if (ResourceFormatImporter::get_singleton()->recognize_path(p_path)) {
const String &internal_path = ResourceFormatImporter::get_singleton()->get_internal_resource_path(p_path);
if (!internal_path.is_empty() && !FileAccess::exists(internal_path)) { // If path is empty (error), keep the code flow to the error.
return Vector<String>();
}
}

List<String> deps;
ResourceLoader::get_dependencies(p_path, &deps);

Expand Down

0 comments on commit 6a3095a

Please sign in to comment.