How can I find out when a file is created? (In the Filesystem)
What I have tried
I can find out when a file is renamed with: EditorInterface.get_file_system_dock().files_moved.connect(_file_moved)
Reading the Docs on FileSystemDock I assumed it might be EditorInterface.get_file_system_dock().instantiate.connect(_intantiate)
for file creation but that doesn`t seem to be it.
Generally im not sure what the docs mean when they say the instantiate signal is triggered when “scenes” are instantiated. It doesn’t appear to be triggered when I create a Scene as a file, nor when one is instantiated in the editor using .instantiate in an @tool script, nor when a Scene is instantiated in game.
Hi thx for your reply. From testing unfortunately non of the Signals seem to be what I want to do.
I tried to get inspiration from this addon.
This ended up giving me a lot of confusion and for now I lack the time to get into this. For now I conclude that this is possible but not easily possible.
I am trying to write a plugin which ensures that naming conventions (which are specified by a file) are correctly used. For example I could say that I want folders should be named as snake_case, and if this is done incorrectly the folder will be highlighted and there will be a option to convert to my standard. This is supposed to help people working in teams to keep to 1 naming convention.
For your use case, I also recommend you either enforce a rule or don’t. Don’t be wishy-washy. In which case you don’t need to highlight it and create an interface to choose to update it - just change it.
If you really are sold on your workflow, then take a look at EditorFileSystem, which you have to interface with using EditorInterface.get_resource_filesystem().
It sounds like you want a directory watchdog. There are plenty of OS utilities. But there is also
a Godot plugin that looks like it does what you want. I’ve not tested it.
The code looks straightforward and uses func _process() to check for any file system changes.