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::{
41 gglib_data_dir, llama_cli_path, llama_config_path, llama_cpp_dir, llama_server_path,
42};
43
44// Models directory
45pub use models::{
46 DEFAULT_MODELS_DIR_RELATIVE, ModelsDirResolution, ModelsDirSource, default_models_dir,
47 resolve_models_dir,
48};
49
50// PID tracking
51pub use pids::pids_dir;
52
53// Directory operations
54pub use ensure::{DirectoryCreationStrategy, ensure_directory, verify_writable};
55
56// Configuration persistence
57pub use config::{env_file_path, persist_env_value, persist_models_dir};
58
59// Pure resolver for testing and CLI
60pub use resolver::ResolvedPaths;