4个版本
| 0.2.0 | 2023年8月28日 | 
|---|---|
| 0.1.6 | 2023年4月15日 | 
| 0.1.5 | 2023年4月15日 | 
| 0.1.0 | 2023年3月30日 | 
在文件系统类别中排名1305
被utrans使用
7KB
78 行
realpath-rs
是python3的os.path.realpath的跨平台Rust等价物
用法
use realpath::*; 
use std::path::PathBuf; 
let src = PathBuf::from("Cargo.toml");
let dest : PathBuf = realpath(&src)?; 
println!("{} -> {}", src, dest.display()); //Returns Cargo.toml -> /path/to/Cargo.toml on linux and Drive:\path\to\Cargo.toml on windows
//For windows 
let src = PathBuf::from(r"Doge.exe");
let dest : PathBuf = realpath_win(&src , false)?; 
println!("{}" , dest.display()); //Returns \\?\Drive:\path\to\Doge.exe
let dest : PathBuf = realpath_win(&src , true)?;
println!("{}" , dest.display()); //Returns Drive:\path\to\Doge.exe
//Inner functionality 
let dest = realpath_og(&src)?;
println!("{}" , dest.display()); //Returns /path/to/Cargo.toml on linux and \\?\Drive:\path\to\Cargo.toml on windows
lib.rs:
用法
#no_run
use crate::realpath::realpath; 
use std::path::PathBuf; 
let src = PathBuf::from("Cargo.toml");
let dest : PathBuf = realpath(&src)?; 
println!("{} -> {}", src.display(), dest.display()); 
依赖项
~125KB