# `QuakeServer.Console.Configs`
[🔗](https://github.com/jaman/quake_server/blob/v0.1.0/lib/quake_server/console/configs.ex#L1)

The console's `exec` and `cfg_save`, as FTE's `Cmd_Exec_f` and `Cmd_WriteConfig_f`
run them, with FTE's main config `fte.cfg`.

`exec name` reads `name`, or `name.cfg` when there is no `name`, from the table's home
directory (`QuakeServer.Cvars.home/1`) first and then the game's files; a name
starting `../` or `./` is refused. Its commands run before the rest of what was being
run, and:

  * `exec config.cfg` (or `q3config.cfg`) runs `exec fte.cfg` after it, and is refused
    when `default.cfg` is found earlier in the search order than it (`depth/2`);
    `exec fte.cfg` is refused the same way
  * after `config.cfg`, `q3config.cfg` or `fte.cfg`, `exec default.cfg` runs when
    `default.cfg` is found earlier than it; a `vid_restart` line in them is made a
    comment
  * after `default.cfg`, `cvar_lockdefaults 1` runs (not for one the server execs), so
    its values become the defaults
  * a UTF-8 byte order mark is skipped

`execing name` is printed while `cl_warncmd` or `developer` is set; `couldn't exec
name` when there is no such file.

`cfg_save [name]` writes the key bindings (`QuakeServer.Console.Bindings.write/1`,
while `cfg_save_binds` is set), the console aliases and the archived variables
(`QuakeServer.Cvars.archive_text/2`; every variable while `cfg_save_all` is set) to
`fte.cfg` in the home directory, or to `configs/name.cfg`, under a `// FTE config file
(date)` line, and marks them saved; `cfg_save_ifmodified` does so only when an
archived variable changed.

# `depth`

```elixir
@spec depth(QuakeServer.Server.t(), String.t()) :: integer()
```

Where file `name` is in the search order: -1 in the home directory, otherwise the
game source's `depth/1` (0 for any file when the source has none); `0x7FFFFFFF` when
there is no such file.

# `exec`

```elixir
@spec exec(QuakeServer.Server.t(), [String.t()], :local | :server) ::
  {QuakeServer.Server.t(), [String.t()]}
```

Run `exec` with its words, from the console (`:local`) or the server; the server and
the commands to run before the rest.

# `save`

```elixir
@spec save(QuakeServer.Server.t(), String.t(), [String.t()]) :: QuakeServer.Server.t()
```

Run `cfg_save` or `cfg_save_ifmodified` (`command`) with its words.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
