Skip to content

armgit / xerj

Public Imported from GitHub
0

AI search engine and MCP server for bots and agents. One Rust binary indexes code, docs, logs, JSONL/CSV and PDFs for BM25 full-text, vector and hybrid search, code search without grep, agent memory and RAG. Elasticsearch-compatible API; Corpus Hub serves hundreds of reference memory corpora.

fix(autoindex): resolve home via xerj_common::home::home_dir

xerj-orgf5128d98c990
diff --git a/engine/crates/xerj-autoindex/src/lib.rs b/engine/crates/xerj-autoindex/src/lib.rs
index 5b62320ba..089cb25cb 100644
--- a/engine/crates/xerj-autoindex/src/lib.rs
+++ b/engine/crates/xerj-autoindex/src/lib.rs
@@ -9627,8 +9627,10 @@ fn run_status(cfg: StatusCfg) -> Result<i32> {
let dirs: Vec<std::path::PathBuf> = match &cfg.state_dir {
Some(d) => vec![d.clone()],
None => {
- let home = std::env::var("HOME").unwrap_or_else(|_| "/tmp".into());
- let base = Path::new(&home).join(".xerj").join("autoindex");
+ let base = xerj_common::home::home_dir()
+ .unwrap_or_else(|| std::path::PathBuf::from("/tmp"))
+ .join(".xerj")
+ .join("autoindex");
std::fs::read_dir(&base)
.map(|rd| rd.flatten().map(|e| e.path()).collect())
.unwrap_or_default()
diff --git a/engine/crates/xerj-autoindex/src/state.rs b/engine/crates/xerj-autoindex/src/state.rs
index 2329b0225..6520a1db3 100644
--- a/engine/crates/xerj-autoindex/src/state.rs
+++ b/engine/crates/xerj-autoindex/src/state.rs
@@ -766,8 +766,8 @@ fn run_id_in_second(second: &str) -> String {
}
pub fn default_state_dir(root: &str, url: &str, prefix: &str) -> PathBuf {
- let home = std::env::var("HOME").unwrap_or_else(|_| "/tmp".into());
- Path::new(&home)
+ xerj_common::home::home_dir()
+ .unwrap_or_else(|| PathBuf::from("/tmp"))
.join(".xerj")
.join("autoindex")
.join(crate::ids::state_key(root, url, prefix))
diff --git a/engine/crates/xerj-autoindex/src/xc.rs b/engine/crates/xerj-autoindex/src/xc.rs
index 9dc8200cd..2c8dca483 100644
--- a/engine/crates/xerj-autoindex/src/xc.rs
+++ b/engine/crates/xerj-autoindex/src/xc.rs
@@ -30,8 +30,9 @@ pub fn code_root() -> PathBuf {
return PathBuf::from(home);
}
}
- let home = std::env::var("HOME").unwrap_or_else(|_| ".".to_string());
- Path::new(&home).join(".xerj-code")
+ xerj_common::home::home_dir()
+ .unwrap_or_else(|| PathBuf::from("."))
+ .join(".xerj-code")
}
/// `--url` flag > `XERJ_URL` > `http://localhost:9200`. Unlike `autoindex`