Skip to main content

Linux to Windows Path or Windows to Linux path converter

Project description

STV Path Converter 🌐

A smart and versatile command-line tool that supports flexible conversion between Windows and Linux path formats, offering style customization and advanced formatting options.

中文版


Key Features ✨

  • Automatic Direction Detection: Intelligently identifies input path format (Windows ↔ Linux).
  • Multi-Style Support: Compatible with WSL, Cygwin, and POSIX path standards.
  • Environment Variable Handling: Optionally expands or preserves environment variables (%VAR%$VAR).
  • Custom Mount Prefix: Define personalized mount points (e.g., /my-mount/).
  • Format Control:
    • Quote handling policy (always/auto/never)
    • Trailing slash management
    • Case conversion (force lowercase/uppercase)
  • Path Validation: Checks for illegal characters in Windows paths.
  • Batch Processing: Supports reading paths from files or standard input.

Installation Guide 📦

Install via pip

pip install stv_path_converter  

Build from Source

  1. Clone the repository:
    git clone https://github.com/StarWindv/win-linux-path_converter  
    
  2. Install using Poetry:
    cd win-linux-path_converter  
    pip install .  
    

Usage Examples 🛠️

Basic Conversion

stv_path "C:\Program Files"  
# Output: /mnt/c/Program\ Files  

stv_path "/my_mount/c/user/docs" -m my_mount  
# Output: C:\home\user\docs  

Quick Reference for Advanced Options

Option Description
-d, --direction Conversion direction: auto (default), win-to-linux, linux-to-win
-s, --style Conversion style: wsl, cygwin, posix (default: wsl)
-m, --mount-prefix Custom mount prefix (e.g., /my-mount/)
-q, --quote Quote handling policy (auto/always/never)
-t, --trailing-slash Trailing slash handling (keep/always/never)
--lower/--upper Force lowercase/uppercase output
-e, --expand-env Expand environment variables
--validate Validate Windows path legality

Scenario Examples

  1. Convert Windows UNC path to WSL format:

    stv_path "\\server\share\file.txt" --style wsl  
    # Output: /mnt/server/share/file.txt  
    
  2. Convert Cygwin path to quoted Windows path:

    stv_path -d linux-to-win "/cygdrive/d/My Documents" --quote always  
    # Output: "D:\My Documents"  
    
  3. Batch convert paths from a file:

    stv_path -i paths.txt  
    

Project Structure 🌳

.
├── LICENSE  
├── README.md  
├── pyproject.toml  
└── src  
    └── stv_path_converter  
        ├── __init__.py  
        ├── core  
        │   ├── __init__.py  
        │   ├── converter.py    # Core conversion logic  
        │   └── stv_parse.py    # Path parsing utilities  
        ├── main.py             # CLI entry point  
        ├── text  
        │   ├── __init__.py  
        │   └── change_text.py  # Text formatting helpers  
        └── utils  
            ├── __init__.py  
            ├── head.py         # Header utilities  
            └── lic.py          # License management  

Contribution Guidelines 🤝

Contributions are welcome! Feel free to submit issues and PRs anytime!


License 📜

This project is licensed under the MIT License. See LICENSE for details.


🛠️ Crafted for cross-platform developers.

Version Highlights

  • Localization Optimization: Technical terminology tailored for Chinese users
  • Format Adaptation: Complies with Chinese punctuation and typesetting conventions
  • Scenario-Based Examples: Practical demonstrations aligned with real development needs
  • Clear Structure: Maintains consistent hierarchy with the English version

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

stv_path_converter-0.0.1.tar.gz (11.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

stv_path_converter-0.0.1-py3-none-any.whl (9.8 kB view details)

Uploaded Python 3

File details

Details for the file stv_path_converter-0.0.1.tar.gz.

File metadata

  • Download URL: stv_path_converter-0.0.1.tar.gz
  • Upload date:
  • Size: 11.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for stv_path_converter-0.0.1.tar.gz
Algorithm Hash digest
SHA256 f2d6b8036c8dfe69eda886833c5b46afd60a9ab6c7d73488e6859bfa0b1446ed
MD5 8324fae8238bef933e95ca97c27fdfdc
BLAKE2b-256 854c627bf534332dbf9a7771dc54bb084b5daab9c6aa9187cdeb1bf2bebfbab3

See more details on using hashes here.

File details

Details for the file stv_path_converter-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for stv_path_converter-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e8af69e5a886cba9b939fcdd0a97d70c6451ca645b5c793f5b5441b5767bb10a
MD5 a7935b835bddc2514dc591b2e648fff1
BLAKE2b-256 d9b88db85c1eadc2aaad807c61ba084b794302e2355e14b648a925d76f0fdf32

See more details on using hashes here.

Supported by

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