Logo FSBarV1_Archived

EngineDiscovery Module

Functions for discovering and resolving BAR engine installations.

Functions and values

Function or value Description

defaultDataDir ()

Full Usage: defaultDataDir ()

Parameters:
    () : unit

Returns: string option The data directory path, or None if not found.

Returns the standard BAR data directory path if it exists and contains the expected maps/ and packages/ subdirectories.

() : unit
Returns: string option

The data directory path, or None if not found.

discoverEngines dataDir

Full Usage: discoverEngines dataDir

Parameters:
    dataDir : string - The BAR data directory to scan.

Returns: DiscoveredEngine list A list of discovered engine installations, newest first.

Scans the given data directory for installed engine versions. Returns a list of discovered engines sorted by version string descending (newest first).

dataDir : string

The BAR data directory to scan.

Returns: DiscoveredEngine list

A list of discovered engine installations, newest first.

discoverGameVersion dataDir tag

Full Usage: discoverGameVersion dataDir tag

Parameters:
    dataDir : string - The BAR data directory containing rapid/ subdirectory.
    tag : string - The rapid tag to resolve (e.g., "byar:test").

Returns: DiscoveredGame option The discovered game version, or None if the tag is not found.

Parses the rapid versions.gz file to resolve a game version tag to a concrete game name and hash.

dataDir : string

The BAR data directory containing rapid/ subdirectory.

tag : string

The rapid tag to resolve (e.g., "byar:test").

Returns: DiscoveredGame option

The discovered game version, or None if the tag is not found.

resolveEngine configPath

Full Usage: resolveEngine configPath

Parameters:
    configPath : string option - Optional path to engine-version.json for version pinning.

Returns: EngineResolution The resolved engine, game version, and resolution source.

Resolves the engine to use by checking, in order: (1) FSBAR_TEST_ENGINE / HIGHBAR_TEST_ENGINE environment variable, (2) engine-version.json config file (if configPath is provided), (3) automatic detection from the standard BAR data directory. Logs the resolved version and source. Raises an exception if no engine is found.

configPath : string option

Optional path to engine-version.json for version pinning.

Returns: EngineResolution

The resolved engine, game version, and resolution source.

resolveOverrideEnvVar ()

Full Usage: resolveOverrideEnvVar ()

Parameters:
    () : unit

Returns: (type)

Resolves which env-var override path to use (spec 045 FR-009). Prefers FSBAR_TEST_ENGINE; falls back to the legacy HIGHBAR_TEST_ENGINE. When both are set to different non-empty values, FSBAR_TEST_ENGINE wins and Conflict is populated with (fsbarValue, highbarValue).

() : unit
Returns: (type)

validateEngine binaryPath versionString

Full Usage: validateEngine binaryPath versionString

Parameters:
    binaryPath : string - The path to the engine binary to validate.
    versionString : string - The version string for error reporting.

Validates that an engine binary exists and is executable. Raises an exception with an actionable error message if validation fails.

binaryPath : string

The path to the engine binary to validate.

versionString : string

The version string for error reporting.

Type something to start searching.