A utility for converting file paths between WSL and Windows formats
Project description
wslconv
A utility for converting file paths between WSL (Windows Subsystem for Linux) and Windows formats.
wslconv helps developers working with WSL, bridge the path differences between Windows and Linux, making the experience smoother and error-free.
Features
- Detect and convert paths automatically based on their format.
- Support for native Linux paths, native Windows paths, Linux paths on Windows, and Windows paths on Linux.
- Simple, intuitive API for developers.
Installation
To install wslconv, use pip:
pip install wslconv
Quickstart
Here's a quick example:
from wslconv import WSLPathConverter
# Create an instance with the path and distro name
converter = WSLPathConverter("C:\\Users\\user\\Documents", "Ubuntu")
# Convert to Linux format
linux_path = converter.to_linux()
print(linux_path) # Expected: /mnt/c/Users/user/Documents
# Convert to Windows format
windows_path = converter.to_windows()
print(windows_path) # Expected: C:\Users\user\Documents
API Reference
WSLPathConverter
Main class for the path conversion.
Methods
__init__(self, path, distro)
: Initialize with a path and the name of the WSL distro.filesystem_type(self)
: Return the filesystem type of the path (Linux
orWindows
).os_type(self)
: Return the OS type based on the path format (Linux
orWindows
).to_linux(self)
: Convert the path to its Linux representation.to_windows(self)
: Convert the path to its Windows representation.
Contributing
Feel free to open issues or PRs if you find any bugs or have suggestions for improvements!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
wslconv-0.0.1.tar.gz
(4.0 kB
view hashes)