Skip to main content

resolve_log_dir

Function resolve_log_dir 

Source
pub fn resolve_log_dir(explicit: Option<PathBuf>, index_dir: &Path) -> PathBuf
Expand description

Resolves the engine log directory.

An explicit override (config key, CLI flag) wins; otherwise the log sits in a logs subdir of index_dir — the location the caller already chose to write the index, so it shares the index’s writability and pollution domain (portable → <exe>\data\index\logs, scope → %LOCALAPPDATA%\…\index\logs). There is deliberately no machine-wide default: falling back to %ProgramData% dirtied the machine for non-elevated callers and panicked when that dir existed but was not writable. The machine service does not rely on this fallback — it passes its own %ProgramData%\find-my-files\logs explicitly. The one implementation of this rule — every entry point resolves through here (ADR-0018; the rule’s prose lives in docs/ARCHITECTURE.md).