use std::path::Path;
use crate::error::Result;
pub fn file_exists(path: &Path) -> bool {
path.exists() && path.is_file()
}
pub fn dir_exists(path: &Path) -> bool {
path.exists() && path.is_dir()
}
pub fn ensure_dir_exists(path: &Path) -> Result<()> {
if !path.exists() {
std::fs::create_dir_all(path)
.map_err(|e| crate::error::Error::FileSystem(format!("Failed to create directory: {}", e)))?;
}
Ok(())
}
pub fn temp_dir() -> Result<tempfile::TempDir> {
tempfile::tempdir()
.map_err(|e| crate::error::Error::FileSystem(format!("Failed to create temporary directory: {}", e)))
}
pub fn random_string(len: usize) -> String {
use rand::{Rng, thread_rng};
use rand::distributions::Alphanumeric;
thread_rng()
.sample_iter(&Alphanumeric)
.take(len)
.map(char::from)
.collect()
}
pub mod manifest;
pub mod logging;