Skip to content

Latest commit

 

History

History
52 lines (35 loc) · 1.94 KB

README.md

File metadata and controls

52 lines (35 loc) · 1.94 KB

wsl-pathlib

Build Status codecov Python Version wemake-python-styleguide

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

MIT

Credits

This project was generated with wemake-python-package. Current template version is: 465848d4daab031f9be6e334ef34af011c2577bc. See what is updated since then.