Resolve and load the active SolidGroundUX framework

SolidGroundUX DocumentationSolidGroundUX
NL

fn$: _framework_locator

Purpose

Determine the filesystem root of the currently executing SolidGroundUX tree from the script's physical path, then load the executable runtime library.

Behavior

  • Resolves the physical path of the executing script.
  • Treats usr, etc, and var as the canonical top-level SolidGroundUX tree roots.
  • Uses the last occurrence of one of those path components to determine the active filesystem root.
  • Resolves production scripts beneath /usr, /etc, or /var to root (/).
  • Resolves staged/development trees to the path prefix preceding the detected usr, etc, or var component.
  • Loads sgnd-exe-common.sh from the resolved framework root when available.
  • For staged/development trees where the executable common library is not present, falls back to the installed framework copy without changing SGND_FRAMEWORK_ROOT.

Globals (write)

SGND_FRAMEWORK_ROOT

Output

Writes fatal bootstrap errors to stderr using printf because framework UI helpers are not available until sgnd-exe-common.sh has been loaded.

Returns

0 when the framework root was resolved and executable common library loaded. 126 when the script path cannot be resolved, no canonical root component can be found, or the executable common library is unreadable.

Usage

  _framework_locator || return $?