use std::path::PathBuf;
pub(in crate::app) struct ScanIndexConfig {
pub(in crate::app) enabled: bool,
pub(in crate::app) path: Option<PathBuf>,
}
impl ScanIndexConfig {
pub(in crate::app) const fn enabled() -> Self {
Self {
enabled: true,
path: None,
}
}
pub(in crate::app) const fn disabled() -> Self {
Self {
enabled: false,
path: None,
}
}
pub(in crate::app) fn with_path(path: PathBuf) -> Self {
Self {
enabled: true,
path: Some(path),
}
}
}
pub(in crate::app) fn default_scan_index_path() -> PathBuf {
if let Some(base) = dirs::cache_dir() {
return base.join("codexusage").join("scan-index.sqlite3");
}
PathBuf::from(".codexusage-scan-index.sqlite3")
}