Skip to content
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

improve the std.fs.deleteTree API to not require an allocator #2886

Closed
andrewrk opened this issue Jul 13, 2019 · 0 comments
Closed

improve the std.fs.deleteTree API to not require an allocator #2886

andrewrk opened this issue Jul 13, 2019 · 0 comments
Labels
breaking Implementing this issue could cause existing code to no longer compile or have different behavior. contributor friendly This issue is limited in scope and/or knowledge of Zig internals. standard library This issue involves writing Zig code for the standard library.
Milestone

Comments

@andrewrk
Copy link
Member

Extracted from a TODO comment:

zig/std/fs.zig

Lines 293 to 294 in bdfb314

/// TODO determine if we can remove the allocator requirement
pub fn deleteTree(allocator: *Allocator, full_path: []const u8) DeleteTreeError!void {

Once #2885 is solved, it should be possible to implement deleteTree without an allocator.

Currently, this function is recursive, which would require an allocator once we have #1006. However, I believe it can be implemented non-recursively, and that it would be a reasonable implementation. It would mean making a few more syscalls, but I think that's generally a nice tradeoff to avoid an entire failure mode.

@andrewrk andrewrk added contributor friendly This issue is limited in scope and/or knowledge of Zig internals. breaking Implementing this issue could cause existing code to no longer compile or have different behavior. standard library This issue involves writing Zig code for the standard library. labels Jul 13, 2019
@andrewrk andrewrk added this to the 0.6.0 milestone Jul 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking Implementing this issue could cause existing code to no longer compile or have different behavior. contributor friendly This issue is limited in scope and/or knowledge of Zig internals. standard library This issue involves writing Zig code for the standard library.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant