Skip to main content

Crate inspect_path

Crate inspect_path 

Source
Expand description

Cross-platform inspection of filesystem paths.

This crate provides utilities for determining the type and status of filesystem paths on both Windows and Unix-like systems. It can distinguish between fixed, removable, and remote paths, and provides additional information for network-backed paths.

The primary entry point is inspect_path, which returns a PathInfo struct describing the given path.

§Platform support

  • Windows

    • Local drives (fixed, removable, CD-ROM, RAM disk)
    • Network shares (UNC paths and mapped drives)
  • Unix

    • Basic filesystem detection (expanding in future releases)

§Examples

use std::path::Path;
use inspect_path::inspect_path;

let info = inspect_path(Path::new(r"C:\")).unwrap();

if info.is_fixed() {
    println!("Fixed path detected");
}

let mut info = inspect_path(Path::new("/home/")).unwrap();

if info.is_status_unknown() {
    info.check_status();
    if info.is_status_mounted() {
        println!("Path Mounted!")
    }
}

§Notes

Some operations (such as determining network mount status) may perform blocking I/O depending on the platform and filesystem.

Re-exports§

pub use platform::check_status;
pub use platform::inspect_path;
pub use platform::mount_path;
pub use platform::try_mount_if_needed;

Modules§

platform

Structs§

PathInfo
Information about a filesystem path, including its type and mount status.

Enums§

InspectPathError
PathStatus
The connection status of a path.
PathType
The general category of a filesystem path.
RemoteType
The underlying remote filesystem type, if applicable.

Functions§

inspect_path_and_status
Inspects a filesystem path and immediately checks its mount status.