CrossPath
English | 简体中文
Advanced cross-platform path handling library for perfect Windows and Unix path conversion.
Features
- ✅ Windows ↔ Unix bidirectional path conversion
- ✅ UNC path support
- ✅ Automatic encoding detection and conversion (UTF-8, UTF-16, Windows-1252)
- ✅ Path security verification (path traversal prevention)
- ✅ Configurable drive letter mappings
- ✅ Path normalization
- ✅ Zero-cost abstractions, high performance
- ✅ Comprehensive error handling
- ✅ Serde serialization support
Installation
[]
= "0.0.1"
Quick Start
use CrossPath;
Advanced Usage
Custom Configuration
use ;
let config = PathConfig ;
let cp = with_config ?;
println!; // /mnt/data/Data/file.txt
Security Checking
use PathSecurityChecker;
let checker = new;
let path = new;
match checker.check
// Sanitize dangerous paths
let safe_path = sanitize_path;
println!; // file__.txt
Encoding Handling
use UnicodeHandler;
// Detect encoding
let bytes = b"C:\\Users\\\x93\x65\x88\x97\\file.txt";
let encoding = detect_encoding;
println!;
// Convert to UTF-8
let utf8_string = convert_to_utf8 ?;
println!;
API Documentation
For detailed API documentation, run:
Supported Features
Path Conversion
- Windows absolute path ↔ Unix absolute path
- Relative path conversion
- UNC path conversion
- Drive letter mapping
- Separator unification
Security
- Path traversal attack detection
- Dangerous pattern detection
- Windows reserved name checking
- System directory access control
Encoding Support
- UTF-8
- UTF-16 LE
- Windows-1252
- Automatic encoding detection
Testing
# Run all tests
# Run specific tests
# Run benchmarks
Contributing
- Fork the repository
- Create a feature branch
- Commit your changes
- Push the branch
- Create a Pull Request
License
MIT OR Apache-2.0 (LICENSE-MIT, LICENSE-APACHE)