Metadata-Version: 2.4
Name: LogicDaemon-win32-symlink-resolve
Version: 0.0.3
Summary: A simple module.
Author: LogicDaemon
Project-URL: Homepage, https://github.com/LogicDaemon/py3-win32-symlink-resolve
Project-URL: Bug Tracker, https://github.com/LogicDaemon/py3-win32-symlink-resolve/issues
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: Microsoft :: Windows :: Windows Vista
Classifier: Operating System :: Microsoft :: Windows :: Windows 7
Classifier: Operating System :: Microsoft :: Windows :: Windows 8
Classifier: Operating System :: Microsoft :: Windows :: Windows 8.1
Classifier: Operating System :: Microsoft :: Windows :: Windows 10
Classifier: Operating System :: Microsoft :: Windows :: Windows 11
Classifier: Operating System :: Microsoft :: Windows :: Windows Server 2008
Classifier: Topic :: System :: Filesystems
Classifier: Typing :: Typed
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# LogicDaemon-py3-win32-symlink-resolve

### resolve_win32_symlink

Resolve Windows symlink targets using the Windows API.
Unlike os.readlink(), this can resolve both absolute and relative symlinks
correctly on Windows, including those that point to UNC paths.

## Installation

```sh
pip install LogicDaemon-win32-symlink-resolve
```

## Usage

```python
from pathlib import Path
from resolve_win32_symlink import resolve_symlink

# Returns the target Path if it's a symlink, or None if the path is not a valid IO_REPARSE_TAG_SYMLINK.
target_path: Path | None = resolve_symlink(Path(r'C:\path\to\symlink'))

if target_path:
    print(f"Symlink points to: {target_path}")
```

### Important Notes and Limitations

- **Windows Only:** This package relies on `ctypes` bindings for `kernel32.dll` and Windows-specific `DeviceIoControl` codes. It is exclusively for Windows environments.
- **Supported Reparse Points:** This module specifically resolves symlinks (`IO_REPARSE_TAG_SYMLINK`). Other types of reparse points, such as directory junctions (`IO_REPARSE_TAG_MOUNT_POINT`), are not supported and will resolve to None.
- **Path Prefixes:** Windows symlink targets often use the NT device prefix `\??\` in the raw substitution name. To preserve idiomatic paths, `resolve_symlink` extracts the cleaner `PrintName` when available, falling back to the target's `SubstituteName` only if `PrintName` is empty.

See [Uploading the distribution archives](https://packaging.python.org/en/latest/tutorials/packaging-projects/#uploading-the-distribution-archives) for more details.
