3 releases

0.1.2 May 18, 2025
0.1.1 Aug 14, 2024
0.1.0 Aug 14, 2020

#276 in Filesystem

Download history 655/week @ 2025-03-24 763/week @ 2025-03-31 940/week @ 2025-04-07 982/week @ 2025-04-14 3685/week @ 2025-04-21 2199/week @ 2025-04-28 2378/week @ 2025-05-05 2337/week @ 2025-05-12 2990/week @ 2025-05-19 3393/week @ 2025-05-26 2181/week @ 2025-06-02 1404/week @ 2025-06-09 2748/week @ 2025-06-16 3957/week @ 2025-06-23 3835/week @ 2025-06-30 3934/week @ 2025-07-07

14,574 downloads per month
Used in y-octo

Custom license

15KB
143 lines

path-ext

Provide convenient methods for path operations

Using

fn test_path() {
    let path1 = PathBuf::from("Z:\\Movies\\[VCB-Studio] Fate Zero [Ma10p_1080p]\\[VCB-Studio] Fate Zero [04][Ma10p_1080p][x265_flac].mkv");
    println!("full path: {}", path1.full_str());
    println!("file ext: {}", path1.ext_str());
    println!("file stem: {}", path1.stem_str());
    println!("file name: {}", path1.name_str());
    let path2 = PathBuf::from("Z:\\Movies");
    let path3 = PathBuf::from("[VCB-Studio] Fate Zero [Ma10p_1080p]\\[VCB-Studio] Fate Zero [04][Ma10p_1080p][x265_flac].mkv");
    let path4 = path2.merge(path3);
    println!("merged full path: {}", path4.full_str());
    println!("file: {}", path1.is_file());
    println!("dir: {}", path2.is_dir());
    if let Some(parent) = path4.parent() {
        for path in parent.walk_dir(|p| p.is_dir()) {
            println!("subdir: {}", path.full_str());
        }
    }
}

output:

running 1 test
full path: Z:\Movies\[VCB-Studio] Fate Zero [Ma10p_1080p]\[VCB-Studio] Fate Zero [04][Ma10p_1080p][x265_flac].mkv
file ext: mkv
file stem: [VCB-Studio] Fate Zero [04][Ma10p_1080p][x265_flac]
file name: [VCB-Studio] Fate Zero [04][Ma10p_1080p][x265_flac].mkv
merged full path: Z:\Movies\[VCB-Studio] Fate Zero [Ma10p_1080p]\[VCB-Studio] Fate Zero [04][Ma10p_1080p][x265_flac].mkv
file: true
dir: true
subdir: Z:\Movies\[VCB-Studio] Fate Zero [Ma10p_1080p]
subdir: Z:\Movies\[VCB-Studio] Fate Zero [Ma10p_1080p]\CDs
subdir: Z:\Movies\[VCB-Studio] Fate Zero [Ma10p_1080p]\Scans
subdir: Z:\Movies\[VCB-Studio] Fate Zero [Ma10p_1080p]\SPs
test test_path ... ok

Dependencies

~0.1–6.5MB
~34K SLoC