mypythontools.paths.wsl_paths module¶
Module with functions for ‘wsl_paths’ class.
!! This is just copy pasted from https://github.com/psychonaute/wsl-pathlib/blob/master/wsl_pathlib/path.py !! to remove unnecessary requirements.
- class mypythontools.paths.wsl_paths.WslPath(*args, **kwargs)[source]¶
Bases:
PosixPath
This is just copy pasted from
https://github.com/psychonaute/wsl-pathlib/blob/master/wsl_pathlib/path.py
Extend pathlib.Path by addding the properties wsl_path and win_path. depending on the plateform base class either pathlib’s PosixPath or WindowsPath. Path objects are instanciated with path representation matching the user’s OS. Both _wsl_path and _win_path properties are lazily converted for their getters, the first time they are requested.
- property win_path: str¶
Initialise WslPath properties and return lazy loaded value. If the Path object had been created by other mean than a direct instanciation, ie: p2 = p1 / “add_on”, then initializes the WslPath properties now. Then builds wsl_path if it was not yet being build. Then returns the string representation of it.
- property wsl_path: str¶
Initialise WslPath properties and return lazy loaded value. If the Path object had been created by other mean than a direct instanciation, ie: p2 = p1 / “add_on”, then initialize the WslPath properties now. Then builds WindowsPath the win_path if it was not yet being build. Then returns the string representation of it.
- mypythontools.paths.wsl_paths.get_drive_letter(path_in, mnt: bool)[source]¶
Return the letter of the windows drive of the path.