semvec/pypi-packages huggingface dataset:
wslbridge 0.1
A bridge to convert WSL paths

# WSLPathConverter

Easily convert paths between Windows and WSL (Windows Subsystem for Linux) environments.

## Features

- Identify the format of provided paths.
- Convert paths to their native Linux or Windows format.
- Handle paths that mix Linux and Windows notations.
- Extract folder structures from paths.

## Installation

```bash
pip install wslbridge
```

## Usage

### Using WSLPathConverter:

```python
from wslbridge import WSLPathConverter

converter = WSLPathConverter(distro_name="Debian")

# Convert a Windows path to its native Linux format:
linux_path = converter.convert_to_linux_format("C:\\Users\\username\\file.txt")
print(linux_path)  # Expected Output: /mnt/c/Users/username/file.txt

# Convert a Linux path to its native Windows format:
windows_path = converter.convert_to_windows_format("/mnt/c/Users/username/file.txt")
print(windows_path)  # Expected Output: C:\Users\username\file.txt
```

### Using UniversalPath:

```python
from wslbridge import UniversalPath

up = UniversalPath("/mnt/c/Users/username/file.txt", distro_name="Debian")

# Get the path in Linux format:
print(up.get_linux_path())  # Expected Output: /mnt/c/Users/username/file.txt

# Get the path in Windows format:
print(up.get_windows_path())  # Expected Output: \\wsl.localhost\Debian\mnt\c\Users\username\file.txt
```

## Notes

- When a path in Windows format is converted to a list of folders, the drive letter is treated specially. For example, the path "C:\Users\username\file.txt" would be represented as `['c', 'Users', 'username', 'file.txt']`.
- The `UniversalPath` class simplifies the usage of the converter by identifying the path format automatically and providing convenient methods to get the path in desired formats.

## Contributing

Feel free to submit issues, fork the repository and send pull requests!