I ran into a weird import issue in Godot 4.2.2 while working on Ultraprocessor Ribbon:
editor/import/resource_importer_scene.cpp:2405 - Condition "!save_path.is_empty() && !DirAccess::exists(save_path.get_base_dir())" is true. Returning: ERR_FILE_BAD_PATH
Error importing 'res://scenes/background/3d_backgrounds/locomotive/locomotive.blend'.
This issue was preventing me from running the game. I tried restarting Godot and deleting my .godot
folder, but these did not resolve the issue.
The relevant source code can be seen here:
Error ResourceImporterScene::_check_resource_save_paths(const Dictionary &p_data) {
Array keys = p_data.keys();
for (int i = 0; i < keys.size(); i++) {
const Dictionary &settings = p_data[keys[i]];
if (bool(settings.get("save_to_file/enabled", false)) && settings.has("save_to_file/path")) {
const String &save_path = settings["save_to_file/path"];
ERR_FAIL_COND_V(!save_path.is_empty() && !DirAccess::exists(save_path.get_base_dir()), ERR_FILE_BAD_PATH);
}
}
return OK;
}
It seems like that Godot is loading a path from an import configuration and is trying to check if a path defined in that config exists. Sure enough, when checking the advanced import settings for the locomotive.blend
file, I found several animations, materials, and meshes in the tree which defined a save_to_file/path
value which pointed to a folder that did not exist.
We didn’t need to import any of these animations, so setting the save_to_file/enabled
property to false
should be enough to fix the issue. However, it looks like Godot keeps setting the value back to true
after I close the advanced import settings dialog. In fact, it seems like I can’t change any of the values at all. So, I resorted to editing the .import
file directly, setting _subresources={}
, and then re-opening Godot. This resolved the issue.