# Ensure Dir.deleteTree does not dereference symlinks · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/e0b77a6b77614538d18b9f0b9e3e7e434ccee4ff)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: e0b77a6b77614538d18b9f0b9e3e7e434ccee4ff

Requested commit: e0b77a6b77614538d18b9f0b9e3e7e434ccee4ff

Commit: e0b77a6b77614538d18b9f0b9e3e7e434ccee4ff

Tree: 04b40728d9b672ef160431fe550e389863ce666d

Author: Jakub Konka

Committer: Jakub Konka

## Message

```
Ensure Dir.deleteTree does not dereference symlinks

Otherwise, the behaviour can lead to unexpected results, resulting
in removing an entire tree that's not necessarily under the root.
Furthermore, this change is needed if are to properly handle dir
symlinks on Windows. Without explicitly requiring that a directory
or file is opened with `FILE_OPEN_REPARSE_POINT`, Windows automatically
dereferences all symlinks along the way. This commit adds another
option to `OpenDirOptions`, namely `.no_follow`, which defaults to
`false` and can be used to specifically open a directory symlink on
Windows or call `openat` with `O_NOFOLLOW` flag in POSIX.

```

## Parents

- [3c8ceb674eb00ac0a70d6a0742234ce520eccf06](https://git.cafe/gitcafe/zig/commit/3c8ceb674eb00ac0a70d6a0742234ce520eccf06?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/e0b77a6b77614538d18b9f0b9e3e7e434ccee4ff?format=markdown)
