mirror of
https://github.com/ziglang/zig.git
synced 2026-02-12 20:37:54 +00:00
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.
This commit is contained in:
parent
34f180901e
commit
db0829c15a
@ -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,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user