use std::path::{Path, PathBuf};
use anyhow::Result;
use notify::{RecommendedWatcher, RecursiveMode, Watcher};
use super::{Handler, WatchSet};
pub struct Platform {
_watcher: RecommendedWatcher,
}
impl Platform {
pub fn new(served: &Path, handler: Handler) -> Result<Self> {
let mut watcher = notify::recommended_watcher(move |event| handler(event))?;
watcher.watch(served, RecursiveMode::Recursive)?;
Ok(Self { _watcher: watcher })
}
pub fn apply(&mut self, _set: WatchSet) -> Vec<(PathBuf, bool)> {
Vec::new()
}
pub fn covers(&self, _folder: &Path) -> bool {
true
}
pub fn watches_within(&self, _path: &Path) -> bool {
false
}
}