Files
claude-code-skills-reference/markdown-tools/scripts/convert_path.py
daymade 3f15b8942c Release v1.27.0: Enhance markdown-tools with Heavy Mode
Add multi-tool orchestration for best-quality document conversion:
- Dual mode: Quick (fast) and Heavy (best quality, multi-tool merge)
- New convert.py - main orchestrator with tool selection matrix
- New merge_outputs.py - segment-level multi-tool output merger
- New validate_output.py - quality validation with HTML reports
- Enhanced extract_pdf_images.py - metadata (page, position, dimensions)
- PyMuPDF4LLM integration for LLM-optimized PDF conversion
- pandoc integration for DOCX/PPTX structure preservation
- Quality metrics: text/table/image retention with pass/warn/fail
- New references: heavy-mode-guide.md, tool-comparison.md

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 21:36:08 +08:00

61 lines
1.4 KiB
Python
Executable File

#!/usr/bin/env python3
"""
Convert Windows paths to WSL format.
Usage:
python convert_path.py "C:\\Users\\username\\Downloads\\file.doc"
Output:
/mnt/c/Users/username/Downloads/file.doc
"""
import sys
import re
def convert_windows_to_wsl(windows_path: str) -> str:
"""
Convert a Windows path to WSL format.
Args:
windows_path: Windows path (e.g., "C:\\Users\\username\\file.doc")
Returns:
WSL path (e.g., "/mnt/c/Users/username/file.doc")
"""
# Remove quotes if present
path = windows_path.strip('"').strip("'")
# Handle drive letter (C:\ or C:/)
drive_pattern = r'^([A-Za-z]):[\\\/]'
match = re.match(drive_pattern, path)
if not match:
# Already a WSL path or relative path
return path
drive_letter = match.group(1).lower()
path_without_drive = path[3:] # Remove "C:\"
# Replace backslashes with forward slashes
path_without_drive = path_without_drive.replace('\\', '/')
# Construct WSL path
wsl_path = f"/mnt/{drive_letter}/{path_without_drive}"
return wsl_path
def main():
if len(sys.argv) < 2:
print("Usage: python convert_path.py <windows_path>")
print('Example: python convert_path.py "C:\\Users\\username\\Downloads\\file.doc"')
sys.exit(1)
windows_path = sys.argv[1]
wsl_path = convert_windows_to_wsl(windows_path)
print(wsl_path)
if __name__ == "__main__":
main()