Skip to main content

Python module to convert between Windows and POSIX path in WSL

Project description

Licence Docs Python PyPI Conda

wslPath

wslPath is a Python module to convert between Windows and POSIX paths in WSL

Install

From PyPI:

pip install wslPath

From Conda:

conda install -c conda-forge wslPath

Usages

import wslPath

# Windows to Posix

## 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"

# Posix to Windows

## 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"

# Identify path type (POSIX or Windows)

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wslPath-0.4.1.tar.gz (3.5 kB view hashes)

Uploaded Source

Built Distribution

wslPath-0.4.1-py3-none-any.whl (3.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page