gglib_core/paths/
mod.rs

1//! Path utilities for gglib data directories and user-configurable locations.
2//!
3//! This module provides the canonical path resolution for all gglib components:
4//! - Database location
5//! - Models directory
6//! - Llama.cpp binaries
7//! - Application data and resource roots
8//!
9//! # Design
10//!
11//! - Returns `PathBuf` and `PathError` for clear error handling
12//! - No interactive/terminal I/O - adapters handle user prompts separately
13//! - OS-specific logic is kept private in `platform`
14
15mod config;
16mod database;
17mod ensure;
18mod error;
19mod llama;
20mod models;
21mod pids;
22mod platform;
23mod resolver;
24
25#[cfg(test)]
26mod test_utils;
27
28// Re-export public API
29
30// Error type
31pub use error::PathError;
32
33// Platform detection and roots
34pub use platform::{data_root, is_prebuilt_binary, resource_root};
35
36// Database
37pub use database::database_path;
38
39// Llama binaries
40pub use llama::{gglib_data_dir, llama_config_path, llama_cpp_dir, llama_server_path};
41
42// Models directory
43#[cfg(not(target_os = "windows"))]
44pub use models::DEFAULT_MODELS_DIR_RELATIVE;
45pub use models::{ModelsDirResolution, ModelsDirSource, default_models_dir, resolve_models_dir};
46
47// PID tracking
48pub use pids::pids_dir;
49
50// Directory operations
51pub use ensure::{DirectoryCreationStrategy, ensure_directory, verify_writable};
52
53// Configuration persistence
54pub use config::{env_file_path, persist_env_value, persist_models_dir};
55
56// Pure resolver for testing and CLI
57pub use resolver::ResolvedPaths;