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
45#[cfg(not(target_os = "windows"))]
46pub use models::DEFAULT_MODELS_DIR_RELATIVE;
47pub use models::{ModelsDirResolution, ModelsDirSource, default_models_dir, resolve_models_dir};
48
49// PID tracking
50pub use pids::pids_dir;
51
52// Directory operations
53pub use ensure::{DirectoryCreationStrategy, ensure_directory, verify_writable};
54
55// Configuration persistence
56pub use config::{env_file_path, persist_env_value, persist_models_dir};
57
58// Pure resolver for testing and CLI
59pub use resolver::ResolvedPaths;