srctools.game

Reads the GameInfo file to determine where Source game data is stored.

class srctools.game.Game(path: str | Path, encoding: str = 'utf8')

Represents the data in GameInfo.

path: Path
game_name: str | None
app_id: str | None
tools_id: str | None
additional_content: str | None
fgd_loc: str | None
search_paths: list[Path]
strata_mounts: list[Keyvalues]

Mount configurations used in Strata Source. Allows loading searchpaths from other games, based on appid.

property root: Path

Return the game’s root folder.

parse_strata_mounts() tuple[list[Path], list[Path]]

Parses the mounts in self.strata_mounts and returns two lists of paths. The first should take priority over gameinfo, the second comes after.

parse_search_path(
prop: Keyvalues,
roots: Sequence[Path] = (),
) Path

Evaluate options like |gameinfo_path|.

get_filesystem() FileSystemChain

Build a chained filesystem from the search paths.

bin_folder() Path

Retrieve the location of the bin/ folder.

srctools.game.find_gameinfo(argv: list[str] | None = None) Game

Locate the game we’re in, if launched as a compiler.

This checks the following:

  • -vproject

  • -game

  • The VPROJECT environment variable.

  • The current folder and all parents.