#[cfg(not(target_os = "windows"))]
pub mod unix;
#[cfg(target_os = "windows")]
pub mod windows;
use alloc::string::String;
use core::option::Option;
#[cfg(not(target_os = "windows"))]
pub use unix::UnixPathExt;
#[cfg(target_os = "windows")]
pub use windows::WindowsPathExt;
use super::PathStyle;
#[must_use]
pub fn current_style() -> PathStyle {
#[cfg(target_os = "windows")]
{
PathStyle::Windows
}
#[cfg(not(target_os = "windows"))]
{
PathStyle::Unix
}
}
pub trait PlatformPath {
fn separator(&self) -> char;
fn is_absolute(&self) -> bool;
fn to_platform_specific(&self) -> String;
}
pub trait PathExt: PlatformPath {
fn get_attributes(&self) -> Option<FileAttributes>;
fn is_accessible(&self) -> bool;
fn get_disk_info(&self) -> Option<DiskInfo>;
}
#[derive(Debug, Clone)]
pub struct FileAttributes {
pub size: u64,
pub is_directory: bool,
pub is_hidden: bool,
pub is_readonly: bool,
pub creation_time: Option<u64>,
pub modification_time: Option<u64>,
}
#[derive(Debug, Clone)]
pub struct DiskInfo {
pub total_space: u64,
pub free_space: u64,
pub filesystem_type: String,
}