the addon should update only when changes happens in the addons folder
WhalesState opened this issue · 2 comments
We are listing the addons
directory and running a while loop to get each folder and we check if it has a plugin.cfg
file and we update the options button and we save cfg file
the problem is, FileSystem
emits filesystem_changed
whenever any file changes like when you save your project or importing assets .. etc, we need to make it only check if the changes happens inside the addons folder.
i was thinking about many ways , to check if files size changed ? last modified date ?
then how ?
the only way i can find since directories don't have last modified date is that we list the addons
directory and we check the names of the folders if it doesn't exist in our plugins
dictionary then we refresh, if the folders are the same, then we return.
this will produce only one issue, if someone removed an addon folder from the OS filesystem and added another folder with the same name but different contents and returned back to godot. because godot will not emit the signal until the user focus the godot window. and the while loop will not recognize any changes so it will keep the old addon information.
if we made this enhancement then we should add this as a warning in the README
file.
a better approach is to wait one frame when the filesystem signal emits and we get the plugins information from the project settings instead of listing the addons
directory, since godot already do it in the same frame.