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.

property root: Path

Return the game’s root folder.

parse_search_path(
prop: Keyvalues,
) 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.