# External record

> Something a game reads from outside its own folder, declared by name in its probe's Externals: Steam's steamapps folder, a workshop, a save folder, another game. The host resolves each into a ResolvedExternal before it calls Open, which reads them from Externals by the same name.

Namespace `EvilEngine.Mounts`, assembly `EvilEngine.Mounts`. Engine commit 4ff877b1.

```csharp
public sealed record External
```

Something a game reads from outside its own folder, declared by name in its probe's [Externals](/docs/api/mountprobe#externals): Steam's `steamapps` folder, a workshop, a save folder, another game. The host resolves each into a [ResolvedExternal](/docs/api/resolvedexternal) before it calls [Open](/docs/api/igameadapter#open), which reads them from [Externals](/docs/api/externals) by the same name.

```csharp
public static readonly External Steamapps =
    External.Folder("steamapps", new ExternalHint.Beside("../..")) with { Shallow = true };
```

The player's pointer can set each one in its `[externals]` table, by name: an absolute path to use instead of the [Hint](#hint), `false` to turn it off, or `true` to turn on one that's off by default. A path set there is used as it is, and a missing one stays missing rather than falling back to the hint.

## Members

### External (constructor)

```csharp
public External(string Name, ExternalKind Kind)
```

Makes an external from its name and kind, on, with no hint. [Folder](#folder) and [Game](#game) are shorter.

### Name (property)

```csharp
public string Name { get; init; }
```

The name the game uses for it, such as `steamapps`, `workshop` or `userdata`. It's the key in the pointer's `[externals]` table and in [Externals](/docs/api/externals#this). Keep it unique among one probe's externals.

### Kind (property)

```csharp
public ExternalKind Kind { get; init; }
```

The [ExternalKind](/docs/api/externalkind): a folder, or another game's mount.

### Title (property)

```csharp
public string? Title { get; init; }
```

A name for a person, or `null`. Garry's Mod's depot games set it, as `Portal` or `Counter-Strike: Source`, and the game's page in Content Mounts lists the titles of those that resolved under Mounts.

### Licence (property)

```csharp
public MountLicence? Licence { get; init; }
```

The [MountLicence](/docs/api/mountlicence) for the product the content comes with, or `null`. Garry's Mod's depot games carry their Steam app. Nothing reads it yet.

### Hint (property)

```csharp
public ExternalHint? Hint { get; init; }
```

Where the host looks when the pointer doesn't say, an [ExternalHint](/docs/api/externalhint). Left `null`, the external is missing unless the pointer names a path.

### Requirement (property)

```csharp
public MountRequirement? Requirement { get; init; }
```

The [MountRequirement](/docs/api/mountrequirement) a game external is found by, or `null` for a folder. A game external needs one.

### On (property)

```csharp
public bool On { get; init; }
```

Whether the game reads it unless told otherwise, `true` by default. One that's off resolves as off, from the game, unless the pointer sets it to `true` or a path.

### GameSwitches (property)

```csharp
public bool GameSwitches { get; init; }
```

Whether only the game's own config turns it on or off, so the pointer can't. Garry's Mod's depot games set it, with [On](#on) read from `garrysmod/cfg/mountdepots.txt`. When the game has it off, it's off whatever the pointer says. When the game has it on, a `false` in the pointer is left out and the resolved [Detail](/docs/api/resolvedexternal#detail) says so, though a path there is still used.

### TakesChildren (property)

```csharp
public bool TakesChildren { get; init; }
```

Whether the pointer can set things under it, as `"<name>/<child>"` entries. Those reach the adapter in the resolved [Children](/docs/api/resolvedexternal#children), keyed by the child's name, rather than counting as [Unknown](/docs/api/externals#unknown). Steam's `workshop` takes them, so `"workshop/123456789" = false` turns one item off.

### Shallow (property)

```csharp
public bool Shallow { get; init; }
```

Whether a folder lists only the files directly in it, never its subfolders. Steam's `steamapps` and `depotcache` are shallow, so reading their manifests never walks every game under `common/`.

### Folder (method)

```csharp
public static External Folder(string name, ExternalHint? hint)
```

Makes a folder external from its name and hint, which can be `null`.

### Game (method)

```csharp
public static External Game(string name, MountRequirement requirement, ExternalHint? hint)
```

Makes a game external from its name, the requirement it's found by and its hint, which can be `null`. No adapter the engine ships declares one yet.
