Skip to content

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

Closed
@andrewrk

Description

@andrewrk

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    breakingImplementing this issue could cause existing code to no longer compile or have different behavior.contributor friendlyThis issue is limited in scope and/or knowledge of Zig internals.standard libraryThis issue involves writing Zig code for the standard library.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions