iocore 3.1.0

IOCore is a safe library for unix CLI tools and Systems programming. IOCore provides the [`iocore::Path`] abstraction of file-system paths designed to replace most [`std::path`] and [`std::fs`] operations with practical methods, other abstractions include: - handling file-system permissions via [`iocore::PathPermissions`] powered by the crate [`trilobyte`]. - handling file-system timestamps via [`iocore::PathTimestamps`] granularly via [`iocore::PathDateTime`]. IOCore provides the [`iocore::walk_dir`] function and its companion trait [`iocore::WalkProgressHandler`] which traverses file-systems quickly via threads. IOcore provides [`iocore::User`] which provides unix user information such as uid, path to home etc. The module [`iocore::env`] provides [`iocore::env:args`] returns a [`Vec<String>`] from [`std::env:args`], and [`iocore::env:var`] that returns environment variables as string.
Documentation
use k9::assert_equal;

use iocore::{Error, Path, User, Result};


fn home_path() -> String {
    User::id().unwrap().home().unwrap()
}

fn home_tests_path() -> Path {
    let folder = Path::new("~/.tmp/tests").try_canonicalize();
    assert!(folder.to_string().starts_with(home_path().as_str()));
    folder
}
#[test]
fn test_collapse() -> Result<()> {
    let tests_path = home_tests_path();
    let sub_path = tests_path.join("subfolder").join("file");
    sub_path.write_unchecked(&[]);
    assert_equal!(sub_path.collapse(), Path::new("~/.tmp/tests/subfolder/file"));
    Ok(())
}