Add wsl_path and win_path Properties to pathlib.Path Class.
Project description
wsl-pathlib
Extend pathlib.Path
by addding the properties wsl_path
and win_path
that holds respectively the WSL (Windows Subsystem for Linux) and Windows representation of the Path
object.
Features
- Lazy loading of the wsl_path and win_path properties on first access.
- Base
Path
object remains fully functional. - Obviously works on both WSL and Windows side.
Limitations
- Only works for the windows drives, (paths living in the wsl's
'/mnt/'
mount point) so'/home/'
won't work for example.
Installation
pip install wsl-pathlib
Usage
from wsl_pathlib.path import WslPath
# Running on WSL
wsl_p = WslPath("C:\\foo")
print(wsl_p)
# => '/mnt/c/foo'
print(wsl_p.exists())
# => True
print(wsl_p.win_path)
# => 'C:\foo'
wsl_p2 = wsl_p / "file.txt"
print(wsl_p2.win_path)
# => 'C:\foo\file.txt'
License
Credits
This project was generated with wemake-python-package
. Current template version is: 465848d4daab031f9be6e334ef34af011c2577bc. See what is updated since then.
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
wsl_pathlib-0.1.3.tar.gz
(4.1 kB
view hashes)
Built Distribution
Close
Hashes for wsl_pathlib-0.1.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d708a52a6b17fe05c0d7200d91d40f39969381198fdf02a1433f4f9aa5d867c8 |
|
MD5 | c77e14a91647c12e48086f9170714158 |
|
BLAKE2b-256 | 7a28370f971d0403e564aa09d0a2d207a8c2123dc03af9f5ad5b7b0d41190d82 |