Vixen
02b45cc4
csharp
public sealed class StandardFileSystemHost

The desktop answer to "where does this platform keep things": the OS's own conventions, resolved through GetFolderPath.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

Shared by every head that runs on a desktop operating system — the windowed one and the headless one both — because a dedicated server writes its saves and caches to the same places a game does, and having two implementations of that would mean two places for it to be wrong.

The per-OS conventions are the BCL's rather than ours: ApplicationData is %APPDATA% on Windows, $XDG_DATA_HOME (falling back to ~/.local/share) on Linux, and ~/Library/Application Support on macOS, and the same three-way split holds for the local, roaming and cache distinctions. Reimplementing that would be reimplementing it slightly differently.

Directories are created when this is constructed rather than on first write, so a permissions problem surfaces at boot with a path in the message instead of halfway through a save.

Fields and properties (5)

  • public string ApplicationDirectory

    The read-only location the application's shipped content lives in.

  • public string DataDirectory

    The read-write location for data that must survive a restart.

  • public string CacheDirectory

    The read-write location for data the platform may delete at any time.

  • public string TemporaryDirectory

    The read-write location for scratch data that need not survive the session.

  • public bool IsSandboxed

    Always : a desktop process may read the whole disk.

Methods (3)

  • public StandardFileSystemHost(string organisation, string application, string? applicationDirectory = null)

    Resolves the standard locations for one application.

  • public void MountStandardLocations(VirtualFileSystem fileSystem)

    Mounts /app, /data, /cache and /temp onto this platform's providers.

  • public ValueTask<bool> RequestPermissionAsync(PermissionKind permission, CancellationToken cancellationToken = default(CancellationToken))

    Always granted: a desktop has no permission prompts to show.

Used by (3)

  • DesktopPlatformVixen.Platform.Desktop
  • HeadlessPlatformVixen.Platform.Headless
  • StandardFileSystemHostTestsVixen.Platform.Tests