# Fix windows.CreateSymbolicLink/ReadLink for non-relative paths · gitcafe/zig

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

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

Visibility: public

Requested revision: 19b219bc8adbfeb1d1a9faa691563a8e3ff390b8

Requested commit: 19b219bc8adbfeb1d1a9faa691563a8e3ff390b8

Commit: 19b219bc8adbfeb1d1a9faa691563a8e3ff390b8

Tree: cb907f834adcde3dd47bd1a0fbba12e0a9db969f

Author: Ryan Liptak

Committer: Ryan Liptak

## Message

```
Fix windows.CreateSymbolicLink/ReadLink for non-relative paths

This fixes a few things:
- Previously, CreateSymbolicLink would always create a relative link if a `dir` was provided, but the relative-ness of a link should be determined by the target path, not the null-ness of the `dir`.
- Special handling is now done to symlink to 'rooted' paths correctly (they are treated as a relative link, which is different than how the xToPrefixedFileW functions treat them)
- ReadLink now correctly supports UNC paths via a new `ntToWin32Namespace` function which intends to be an analog of `RtlNtPathNameToDosPathName` (RtlNtPathNameToDosPathName is not used because it seems to heap allocate as it takes an RTL_UNICODE_STRING_BUFFER)

```

## Parents

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

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