cfgmatic-paths 0.1.3

Cross-platform configuration path discovery following XDG and platform conventions
Documentation
//! Standard filesystem implementation.

use super::Fs;
use std::io;
use std::path::Path;

/// Standard filesystem using `std::fs`.
#[derive(Debug, Clone, Copy, Default)]
pub struct StdFs;

impl StdFs {
    /// Create a new standard filesystem accessor.
    #[must_use]
    pub const fn new() -> Self {
        Self
    }
}

impl Fs for StdFs {
    fn exists(&self, path: &Path) -> bool {
        path.exists()
    }

    fn is_file(&self, path: &Path) -> bool {
        path.is_file()
    }

    fn is_dir(&self, path: &Path) -> bool {
        path.is_dir()
    }

    fn create_dir_all(&self, path: &Path) -> io::Result<()> {
        std::fs::create_dir_all(path)
    }
}