Add remove_recursive and remove_recursive_absolute to DirAccess#120860
Add remove_recursive and remove_recursive_absolute to DirAccess#120860Elip100 wants to merge 2 commits into
Conversation
|
I'm not sure this should be exposed in itself, it doesn't match the rest of the usage of |
I agree that the current implementation is definitely a bit strange and inconsistent with other |
|
I think that would be much more appropriate, especially to match what the requested feature is |
No idea, but it does handily stop users shooting themselves in the foot. 😁 Erasing directories and their contents in one command is a pretty potent weapon (I don't think the OS offers this directly). |
|
I agree, that it would be better to have
I think if this is split into two commands (remove contents and then the directory) then it isn't that much different, because if you remove contents first, you already lost everything useful inside, so the one command thing would just be more convenient :D + if anyone would pass a path without checking, if they should remove it, then they're just looking for trouble anyway. EDIT: I also think that most people would use this function on "user://" paths, which at most would break the game and not the whole system. |
It would pretty much be the Godot equivalent of |
|
I've committed changes to undo exposing |
What problem(s) does this PR solve?
Additional information
This just exposes an existing DirAccess function to allow its use in GDScript. The function allows you to recursively remove the contents of a directory. I don't know if there is an important reason why it wasn't exposed in the first place, butI proposed this idea a while ago, and several people agreed it would be a nice QOL feature, because there is not currently a DirAccess method that allows you to remove a non-empty directory easily. From my testing, it works perfectly fine, and I can't find a reason to not include it.See #120860 (comment) for new implementation