aboutsummaryrefslogtreecommitdiff
path: root/lib/std/fs/test.zig
diff options
context:
space:
mode:
authorRyan Liptak <squeek502@hotmail.com>2022-10-04 23:30:15 -0700
committerRyan Liptak <squeek502@hotmail.com>2022-10-05 03:26:13 -0700
commit8cec8f6dddeec46f609afd42c6024c55e5c126d9 (patch)
tree07af7bbc28128723ee47f5baa97b81086828bc50 /lib/std/fs/test.zig
parent5059384b570a4cb554215c8091ff00d77a0ebadf (diff)
downloadzig-8cec8f6dddeec46f609afd42c6024c55e5c126d9.tar.gz
zig-8cec8f6dddeec46f609afd42c6024c55e5c126d9.zip
fs.Dir.deleteTree: Reduce the number of failing deleteFile calls
There are two parts to this: 1. The deleteFile call on the sub_path has been moved outside the loop, since if the first call fails with `IsDir` then it's very likely that all the subsequent calls will do the same. Instead, if the `openIterableDir` call ever hits `NotDir` after the `deleteFile` hit `IsDir`, then we assume that the tree was deleted at some point and can consider the deleteTree a success. 2. Inside the `dir_it.next()` loop, we look at entry.kind and only try doing the relevant (deleteFile/openIterableDir) operation, but always fall back to the other if we get the relevant error (NotDir/IsDir).
Diffstat (limited to 'lib/std/fs/test.zig')
0 files changed, 0 insertions, 0 deletions