# windows: Always try using POSIX_SEMANTICS/etc for rename/delete · gitcafe/zig

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

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

Visibility: public

Requested revision: 88fd8ce8604f1c8ea79797f7263ac7b81910da9b

Requested commit: 88fd8ce8604f1c8ea79797f7263ac7b81910da9b

Commit: 88fd8ce8604f1c8ea79797f7263ac7b81910da9b

Tree: 9550825076c18c92feae5dce15a8d1640a4237ca

Author: Ryan Liptak

Committer: Ryan Liptak

## Message

```
windows: Always try using POSIX_SEMANTICS/etc for rename/delete

The compile-time check against the minimum version here wasn't appropriate, since it still makes sense to try using FILE_RENAME_INFORMATION_EX even if the minimum version is something like `xp`, since that doesn't rule out the possibility of the compiled code running on Windows 10/11. This compile-time check was doubly bad since the default minimum windows version (`.win10`) was below the `.win10_rs5` that was checked for, so when providing a target like `x86_64-windows-gnu` it'd always rule out using this syscall.

After this commit, we always try using FILE_RENAME_INFORMATION_EX and then let the operating system tell us when some aspect of it is not supported. This allows us to get the benefits of these new syscalls/flags whenever it's actually possible.

The possible error returns were validated experimentally:
- INVALID_PARAMETER is returned when the underlying filesystem is FAT32
- INVALID_INFO_CLASS is returned on Windows 7 when trying to use FileRenameInformationEx/FileDispositionInformationEx
- NOT_SUPPORTED is returned on Windows 10 >= .win10_rs5 when setting a bogus flag value (I used `0x1000`)

```

## Parents

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

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