-
-
Notifications
You must be signed in to change notification settings - Fork 21.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Directory must be open before using remove (3.2.3 rc1) #40763
Comments
The new behavior is correct, the previous one was quite dangerous.
It would remove the If you want to delete a folder in e.g. |
See #40146. |
That is probably a bigger issue than not deleting a directory (at least old me thought so per #24149). Is there any documentation on how the new Directory object should work? It seems a little inconsistent. For example, should
Here's some other questions. Sorry if this has been discussed elswhere. Should a
|
As akien said this is pretty much intended #40763 (comment)
However, this is definitely not intended so this should be fixed |
I'm not going to be at my workspace for a while, so someone else can make a PR (Junior Job?) Here is the current function Lines 1611 to 1625 in 210ccb3
Below if (!alt) {
return err;
} Add if (err != OK) {
return err;
}
(Plus a blank line in my opinion) P.S.: Dang, sorry so many issues arose from my pull request :( |
There appears to be a lot of edge cases with the new changes to Directory. Maybe, with all these additional requirements, the Directory object should be deprecated and a new one should be created that has the more complicated behavior. This would allow for the introduction of more consistent but breaking changes. |
The new behavior isn't complicated, just different, and the behavior was intended by the start. All I did was fix the error condition. |
Well as it breaks compat, I think it might be best for On the other hand, there should be better handling of bad input when trying to remove non-existing paths. |
IMO fix up the current directory stuff for 3.2 and redesign it for 4.0 |
Your PR isn't complicated, but the repercussions of it are. Should a
|
@bitwes I don't think that's really in the scope of this issue though. Those edge cases should have been considered when this system was designed in the first place. We can add checks to make Directory more safe to use (for example if you delete something outside of Godot) but that would be against Akien's proposal to just revert these changes for 3.2. IMO:
|
3.2.3 is meant to be released this week, so we don't have much time. So I'm more for preserving compatibility in 3.2.3, and we can take the time to make things work well for 3.2.4, possibly with a slight compat breakage if it really makes sense - but as it stands while the compat breakage does prevent a dangerous case, it's unclear whether the current API is really a good improvement. I would keep the changes in |
Fixed by #40803 for now. Let's see how to handle the various issues that remain with Directory to make it safer and without better input validation. |
Godot version:
3.2.3 rc1
OS/device including version:
macOS 10.15.5
Issue description:
As of 3.2.3 rc1 you must open a directory before using
remove
. Prior to 3.2.3 rc1 you didn't have to open up a directory to delete it, which makes sense. If you are attempting to delete a directory, then you probably don't care if it doesn't exist. If you did, you' d check for it first. The new functionality might be the "right" way but I would argue it is a breaking change and shouldn't be introduced in a patch.Steps to reproduce:
Assuming a directory
user://foo
exists and it is empty.Minimal reproduction project:
See code. Should be enough.
The text was updated successfully, but these errors were encountered: