Expand description
Path utilities for gglib data directories and user-configurable locations.
This module provides the canonical path resolution for all gglib components:
- Database location
- Models directory
- Llama.cpp binaries
- Application data and resource roots
Β§Design
- Returns
PathBufandPathErrorfor clear error handling - No interactive/terminal I/O - adapters handle user prompts separately
- OS-specific logic is kept private in
platform
ModulesΒ§
- config π
- Configuration file utilities.
- database π
- Database path resolution.
- ensure π
- Directory creation and verification utilities.
- error π
- Path-related error types.
- llama π
- Llama.cpp binary path resolution.
- models π
- Models directory resolution.
- pids π
- PID file directory path resolution.
- platform π
- Platform-specific path detection and resolution.
- resolver π
- Pure path resolver for testing and CLI introspection.
StructsΒ§
- Models
DirResolution - Resolution result for the models directory.
- Resolved
Paths - All resolved paths captured in a single struct.
EnumsΒ§
- Directory
Creation Strategy - Strategy for how to handle missing directories when ensuring they exist.
- Models
DirSource - How the models directory was derived.
- Path
Error - Errors that can occur during path resolution and directory operations.
ConstantsΒ§
- DEFAULT_
MODELS_ DIR_ RELATIVE - Default relative location for downloaded models under the userβs home directory.
FunctionsΒ§
- data_
root - Get the root directory for application data (database, config).
- database_
path - Get the path to the gglib database file.
- default_
models_ dir - Return the platform-specific default models directory.
- ensure_
directory - Ensure the provided directory exists and is writable according to the chosen strategy.
- env_
file_ path - Location of the
.envfile that stores user overrides. - gglib_
data_ dir - Get the gglib data directory containing llama binaries.
- is_
prebuilt_ binary - Check if we are running from a pre-built binary (not from the source repo).
- llama_
cli_ path - Get the path to the managed llama-cli binary.
- llama_
config_ path - Get the path to the llama build configuration file.
- llama_
cpp_ dir - Get the path to the llama.cpp repository directory.
- llama_
server_ path - Get the path to the managed llama-server binary.
- persist_
env_ value - Persist a key=value pair into the
.envfile. - persist_
models_ dir - Persist the selected models directory into
.env. - pids_
dir - Returns the directory where PID files are stored.
- resolve_
models_ dir - Resolve the models directory from an explicit override, env var, or default.
- resource_
root - Get the root directory for application resources (binaries, static assets).
- verify_
writable - Verify a directory is writable by attempting to create a test file.