# Windows: Fix \`TooManyParentDirs\` handling for paths that shouldn't be cwd-relative · gitcafe/zig

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

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

Visibility: public

Requested revision: 3f9294c73501f55bcba1fe8b5da1ad2f2b0af9e5

Requested commit: 3f9294c73501f55bcba1fe8b5da1ad2f2b0af9e5

Commit: 3f9294c73501f55bcba1fe8b5da1ad2f2b0af9e5

Tree: 86fce350a6c04eeffbc28f9860865090e8115256

Author: Ryan Liptak

Committer: Ryan Liptak

## Message

```
Windows: Fix `TooManyParentDirs` handling for paths that shouldn't be cwd-relative

Previously, a relative path like `..` would:
- Attempt to be normalized (i.e. remove . and .. without any path resolution), but would error with TooManyParentDirs
- This would make wToPrefixedFileW run it through `RtlGetFullPathName_U` to do the necessary path resolution, but `RtlGetFullPathName_U` always resolves relative paths relative to the CWD

Instead, when TooManyParentDirs occurs, we now look up the path of the passed in `dir` (if it's non-null) and append the relative path to it before giving it to `RtlGetFullPathName_U`. If `dir` is null, then we just give it RtlGetFullPathName_U directly and let it resolve it relative to the CWD.

Closes #16779

```

## Parents

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

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