use anyhow::Result;
use std::path::{Path, PathBuf};
pub struct DirEntry {
pub path: PathBuf,
pub file_name: String,
pub is_dir: bool,
}
pub trait Filesystem {
fn exists(&self, path: &Path) -> bool;
fn is_dir(&self, path: &Path) -> bool;
fn is_file(&self, path: &Path) -> bool;
fn read_to_string(&self, path: &Path) -> Result<String>;
fn read(&self, path: &Path) -> Result<Vec<u8>>;
fn write(&self, path: &Path, contents: &str) -> Result<()>;
fn write_bytes(&self, path: &Path, contents: &[u8]) -> Result<()>;
fn create_dir_all(&self, path: &Path) -> Result<()>;
fn copy_file(&self, src: &Path, dest: &Path) -> Result<()>;
fn rename(&self, from: &Path, to: &Path) -> Result<()>;
fn remove_file(&self, path: &Path) -> Result<()>;
fn remove_dir_all(&self, path: &Path) -> Result<()>;
fn read_dir(&self, path: &Path) -> Result<Vec<DirEntry>>;
fn canonicalize(&self, path: &Path) -> Result<PathBuf>;
}