wslPath
is a Python module designed to convert paths between Windows and POSIX formats within the Windows Subsystem for Linux (WSL).
From PyPI:
pip install wslPath
From Conda:
conda install -c conda-forge wslPath
import wslPath
## Relative path
pathwin = "hoge\\fuga"
wslPath.to_posix(pathwin)
# -> "hoge/fuga"
## Absolute path
pathwin = "C:\\hoge\\fuga"
wslPath.to_posix(pathwin)
# -> "/mnt/c/hoge/fuga"
import wslPath
## Relative path
pathposix = "hoge/fuga"
wslPath.to_windows(pathposix)
# -> "hoge\\fuga"
## Absolute path
pathposix = "/mnt/c/hoge/fuga"
wslPath.to_windows(pathposix)
# -> "C:\\hoge\\fuga"
import wslPath
path = "hoge/fuga"
wslPath.wslpath(path) # Windows OS
# -> "hoge\\fuga"
path = "hoge\\fuga"
wslPath.wslpath(path) # POSIX OS
# -> "hoge/fuga"
import wslPath
path = "hoge/fuga"
wslPath.is_posix_path(path)
# -> True
path = "hoge\\fuga"
wslPath.is_posix_path(path)
# -> False
path = "hoge/fuga"
wslPath.is_windows_path(path)
# -> False
path = "hoge\\fuga"
wslPath.is_windows_path(path)
# -> True