Godot Version
4.4.1.stable
Question
deleting resource files with DirAccess.remove_absolute(file_path) doesnt instantly delete them. instead delays a few ten seconds then removes them from the file manager. help!
4.4.1.stable
deleting resource files with DirAccess.remove_absolute(file_path) doesnt instantly delete them. instead delays a few ten seconds then removes them from the file manager. help!
Have you checked that the directory actually still exists after calling remove_absolute
, and that this isn’t just your file explorer not refreshing immediately? For me (on Ubuntu Linux), the directory is removed immediately.
after deleting the file with code, the file stays both in godots file manager and in os’s file manager. if i just wait like that a few ten seconds the file finally deletes itself, but if i check the file from outside of the godot, from the os’s file manager, then go back to godot’s file manager, it shows deleted… not sure whats causing this
i think it was specifically related with editorplugin? im not sure… this is how i solved:
@tool
class_name PluginBase extends EditorPlugin
static var singleton : PluginBase
func refresh_filesystem():
get_editor_interface().get_resource_filesystem().scan()
static func reach() -> PluginBase:
return singleton
func _enter_tree():
singleton = self
and calling PluginBase.reach().refresh_filesystem()
right after deleting the file, like:
DirAccess.remove_absolute(file_path)
DialogueBase.reach().refresh_filesystem()