use std::path::Path;
use crate::error::AppError;
pub fn marker_path(state_dir: &Path) -> std::path::PathBuf {
state_dir
.parent()
.unwrap_or_else(|| Path::new("."))
.join(".task-incomplete")
}
pub fn create(state_dir: &Path, content: &str) -> Result<(), AppError> {
std::fs::write(marker_path(state_dir), content)?;
Ok(())
}
pub fn remove(state_dir: &Path) -> Result<(), AppError> {
let path = marker_path(state_dir);
if path.exists() {
std::fs::remove_file(path)?;
}
Ok(())
}
pub fn exists(state_dir: &Path) -> bool {
marker_path(state_dir).exists()
}