use std::path::{Path, PathBuf};
use super::{FoundFile, ScanEnv, Scanner};
use crate::registry::Ecosystem;
pub(crate) struct Gpt4allScanner;
impl Scanner for Gpt4allScanner {
fn ecosystem(&self) -> Ecosystem {
Ecosystem::Gpt4all
}
fn detect_root(&self, env: &ScanEnv) -> Option<PathBuf> {
if let Some(root) = env.root_override(self.ecosystem()) {
return root.is_dir().then(|| root.to_path_buf());
}
let home = env.home()?;
[
home.join(".local")
.join("share")
.join("nomic.ai")
.join("GPT4All"),
home.join("Library")
.join("Application Support")
.join("nomic.ai")
.join("GPT4All"),
home.join("AppData")
.join("Local")
.join("nomic.ai")
.join("GPT4All"),
]
.into_iter()
.find(|c| c.is_dir())
}
fn scan(&self, root: &Path) -> Vec<FoundFile> {
super::walk_gguf(root, Ecosystem::Gpt4all)
}
}