Module paths

Module paths 

Source
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 PathBuf and PathError for 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ยง

ModelsDirResolution
Resolution result for the models directory.
ResolvedPaths
All resolved paths captured in a single struct.

Enumsยง

DirectoryCreationStrategy
Strategy for how to handle missing directories when ensuring they exist.
ModelsDirSource
How the models directory was derived.
PathError
Errors that can occur during path resolution and directory operations.

Constantsยง

DEFAULT_MODELS_DIR_RELATIVE
Default relative location for downloaded models on non-Windows platforms.

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 .env file 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 .env file.
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.