Crate cross_path

Crate cross_path 

Source
Expand description

Advanced cross-platform path handling library

Provides perfect compatibility handling for Windows and Linux paths, supporting:

  • Windows ↔ Linux bidirectional path conversion
  • Automatic encoding detection and conversion
  • Path security verification
  • Cross-platform file operations

§Examples

use cross_path::{CrossPath, PathStyle};

// Convert Windows path to Unix path
let path = CrossPath::new(r"C:\Users\name\file.txt")?;
assert_eq!(path.to_unix()?, "/mnt/c/Users/name/file.txt");

// Convert Unix path to Windows path
let path = CrossPath::new("/home/name/file.txt")?;
assert_eq!(path.to_windows()?, r"C:\home\name\file.txt");

Re-exports§

pub use converter::PathConverter;
pub use error::PathError;
pub use formatter::PathFormatter;
pub use parser::PathParser;

Modules§

converter
Path converter module
error
Error handling module
formatter
Path formatter module
parser
Path parser module
platform
Platform-specific operations module Platform-specific path handling operations
security
Security verification module
unicode
Unicode handling module

Structs§

CrossPath
Main cross-platform path structure
PathConfig
Path conversion configuration

Enums§

PathStyle
Path style enumeration

Traits§

PathConvert
Path conversion trait

Type Aliases§

PathResult
Cross-platform path result type