liblitho 0.2.0

cli tool to flash/clone the images to storage devices
Documentation
//! Windows system-disk and busy-volume checks.

use crate::devices::{DeviceError, DeviceMount};
use crate::platform::traits::DeviceSafety;

use super::devices as win_devices;
use super::WindowsPlatform;

impl DeviceSafety for WindowsPlatform {
    fn refuse_system_disk(path: &str) -> Result<(), DeviceError> {
        win_devices::validate_device_not_system_disk(path).map_err(DeviceError::system_disk)
    }

    fn list_mounts(device_path: &str) -> Result<Vec<DeviceMount>, DeviceError> {
        let letters = win_devices::list_mounted_drive_letters(device_path)
            .map_err(DeviceError::query)?;
        Ok(letters
            .into_iter()
            .map(|letter| DeviceMount {
                source: letter.clone(),
                mount_point: format!("{letter}\\"),
            })
            .collect())
    }

    fn refuse_if_busy(path: &str) -> Result<(), DeviceError> {
        win_devices::validate_device_not_busy(path).map_err(DeviceError::busy)
    }

    fn busy_hint() -> &'static str {
        "Confirm the operation to dismount volumes automatically, or close apps using the drive first."
    }
}