Entropic 2.3.8
Local-first agentic inference engine
Loading...
Searching...
No Matches
data_dir.cpp File Reference

Bundled data directory resolution. More...

#include <entropic/config/loader.h>
#include <entropic/entropic_config.h>
#include <entropic/types/logging.h>
#include <cstdlib>
#include <vector>
#include <dlfcn.h>
Include dependency graph for data_dir.cpp:

Go to the source code of this file.

Namespaces

namespace  entropic
 Activate model on GPU (WARM → ACTIVE).
 

Functions

static std::filesystem::path entropic::config::share_dir_from_library ()
 Locate librentropic.so on disk and derive its sibling share dir.
 
ENTROPIC_EXPORT std::filesystem::path entropic::config::resolve_data_dir (const ParsedConfig &config)
 Resolve the bundled data directory.
 

Variables

static auto s_log = entropic::log::get("config")
 

Detailed Description

Bundled data directory resolution.

Version
2.0.5.1

Definition in file data_dir.cpp.

Function Documentation

◆ resolve_data_dir()

std::filesystem::path entropic::config::resolve_data_dir ( const ParsedConfig config)

Resolve the bundled data directory.

Priority:

  1. config.config_dir / "data" (if config_dir set)
  2. CONFIG_ENTROPIC_DATA_DIR (compile-time install path)
  3. Source-tree data/ (development fallback)
Parameters
configParsed config.
Returns
Resolved data directory path.
Version
1.8.1

Priority (v2.0.5.1):

  1. ENTROPIC_DATA_DIR env var (explicit operator override)
  2. config.config_dir / "data" (project-specific override)
  3. Binary-relative discovery via dladdr — <prefix>/share/entropic derived from librentropic.so's on-disk location. Portable across install prefixes regardless of build-time CMAKE_INSTALL_PREFIX.
  4. CONFIG_ENTROPIC_DATA_DIR (compile-time install path, last resort; historically unreliable for relocated installs).
  5. CONFIG_ENTROPIC_SOURCE_DATA_DIR + CWD-relative data/ (development fallback when running from the build tree).

First path that is_directory() on disk wins.

Parameters
configParsed config.
Returns
Resolved data directory path (empty if none found).

Definition at line 81 of file data_dir.cpp.

◆ share_dir_from_library()

static std::filesystem::path entropic::config::share_dir_from_library ( )
static

Locate librentropic.so on disk and derive its sibling share dir.

The install layout is <prefix>/lib/librentropic.so + <prefix>/share/entropic/. dladdr() on any symbol within librentropic resolves to the .so's on-disk path, from which we can compute ../share/entropic relative to the library. This makes the installed package portable: no absolute paths baked at build time, no dependency on the consumer extracting to the same prefix the packager built with.

Returns
Resolved <prefix>/share/entropic path, or empty if dladdr fails (e.g. statically linked with no exported symbols).

Definition at line 37 of file data_dir.cpp.

Variable Documentation

◆ s_log

auto s_log = entropic::log::get("config")
static

Definition at line 17 of file data_dir.cpp.