diff options
| author | Ryan Liptak <squeek502@hotmail.com> | 2022-10-05 19:51:43 -0700 |
|---|---|---|
| committer | Ryan Liptak <squeek502@hotmail.com> | 2022-10-05 19:51:43 -0700 |
| commit | db0829c15ab883b9efe704414fcf8149a3d83026 (patch) | |
| tree | 0933f12d006d7f7cd5f7e36e52347d783d21fa6f /lib/std | |
| parent | 34f180901eaa0fcd5e3bddc6f353604da8bd7e1f (diff) | |
| download | zig-db0829c15ab883b9efe704414fcf8149a3d83026.tar.gz zig-db0829c15ab883b9efe704414fcf8149a3d83026.zip | |
fs.Dir.deleteTree: Fix some handling of NotDir error in deleteFile calls
We don't control sub_path so it may contain directory components; therefore, NotDir is a potential error when acting on sub_path.
Diffstat (limited to 'lib/std')
| -rw-r--r-- | lib/std/fs.zig | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/std/fs.zig b/lib/std/fs.zig index c220200d6a..fb7ae54848 100644 --- a/lib/std/fs.zig +++ b/lib/std/fs.zig @@ -2187,6 +2187,7 @@ pub const Dir = struct { } else |err| switch (err) { error.FileNotFound => break :handle_entry, + // Impossible because we do not pass any path separators. error.NotDir => unreachable, error.IsDir => { @@ -2268,8 +2269,6 @@ pub const Dir = struct { } else |err| switch (err) { error.FileNotFound => return, - error.NotDir => unreachable, - error.IsDir => { treat_as_dir = true; continue :handle_entry; @@ -2281,6 +2280,7 @@ pub const Dir = struct { error.NameTooLong, error.SystemResources, error.ReadOnlyFileSystem, + error.NotDir, error.FileSystem, error.FileBusy, error.BadPathName, |
