Vixen
02b45cc4
csharp
public sealed class VirtualFileSystem

The mount table, and the only file API engine code is allowed to know about.

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

Remarks

Mounts are matched longest-prefix-first, so a provider at /app/dlc takes precedence over one at /app for anything underneath it. Matching is segment-aware, so a mount at /app never captures /application.

Reads are lock-free. The mount table is replaced wholesale on every change and read through a single volatile field, which is the right trade for a structure written a handful of times at start-up and read on every file access — the same shape ServiceRegistry uses, for the same reason.

Fields and properties (1)

  • public IReadOnlyList<VirtualPath> Mounts

    The mounts, most specific first.

Methods (19)

  • public void Mount(VirtualPath path, IFileProvider provider)

    Attaches a provider at a mount point, replacing whatever was there.

  • public bool Unmount(VirtualPath path)

    Detaches whatever is mounted at a path.

  • public bool TryResolve(VirtualPath path, out IFileProvider? provider, out VirtualPath providerPath)

    Finds the provider responsible for a path.

  • public bool Exists(VirtualPath path)

    Whether a file or directory exists.

  • public bool TryGetEntry(VirtualPath path, out FileEntry entry)

    Reads what is known about a file or directory without opening it.

  • public ValueTask<Stream> OpenReadAsync(VirtualPath path, CancellationToken cancellationToken = default(CancellationToken))

    Opens a file for reading.

  • public ValueTask<Stream> OpenWriteAsync(VirtualPath path, CancellationToken cancellationToken = default(CancellationToken))

    Opens a file for writing, creating or truncating it.

  • public ValueTask<Stream> OpenAppendAsync(VirtualPath path, CancellationToken cancellationToken = default(CancellationToken))

    Opens a file for writing at its end, creating it if it is not there.

  • public Stream OpenRead(VirtualPath path)

    Opens a file for reading. Blocking; for editor and tooling code.

  • public Stream OpenWrite(VirtualPath path)

    Opens a file for writing. Blocking; for editor and tooling code.

  • public Stream OpenAppend(VirtualPath path)

    Opens a file for writing at its end. Blocking; for editor and tooling code.

  • public bool Delete(VirtualPath path)

    Deletes a file, or an empty directory.

  • public void CreateDirectory(VirtualPath path)

    Creates a directory and any missing parents.

  • public bool TryMap(VirtualPath path, out IMappedFile? mapped)

    Maps a file into memory, if the mount can.

  • public IEnumerable<FileEntry> Enumerate(VirtualPath directory, bool recursive = false)

    Lists the contents of a directory, including mounts that live under it.

  • public ValueTask<byte[]> ReadAllBytesAsync(VirtualPath path, CancellationToken cancellationToken = default(CancellationToken))

    Reads a whole file.

  • public ValueTask<string> ReadAllTextAsync(VirtualPath path, CancellationToken cancellationToken = default(CancellationToken))

    Reads a whole file as UTF-8 text.

  • public ValueTask WriteAllBytesAsync(VirtualPath path, ReadOnlyMemory<byte> contents, CancellationToken cancellationToken = default(CancellationToken))

    Writes a whole file, creating or replacing it.

  • public ValueTask WriteAllTextAsync(VirtualPath path, string contents, CancellationToken cancellationToken = default(CancellationToken))

    Writes a whole file as UTF-8 text, without a byte-order mark.

Used by (49, showing 40)

  • ContentAddressablesRemote
  • ProgramAddressablesRemote
  • AppBuilderVixen.App.Hosting
  • AppServicesVixen.App.Hosting
  • AssetMaterialSourceTestsVixen.Engine.Renderer.Tests
  • AssetTextureSourceTestsVixen.Engine.Renderer.Tests
  • BundleCacheVixen.Assets
  • BundleCacheTestsVixen.Assets.Tests
  • BundleOdbBackendVixen.Core.Serialization
  • CacheWorldVixen.Assets.Tests
  • CompositorContentTestsVixen.Assets.Tests
  • ContentMountVixen.App.Hosting
  • ContentReferenceTestsVixen.Assets.Tests
  • ContentUpdateVixen.Assets
  • ContentUpdateTestsVixen.Assets.Tests
  • FileOdbBackendVixen.Core.Serialization
  • HeadlessLifecycleTestsVixen.Platform.Headless.Tests
  • IFileSystemHostVixen.Platform
  • LocalBundleSourceVixen.Assets
  • LooseContentSourceVixen.Assets
  • ObjectDatabaseTestsVixen.Core.Serialization.Tests
  • ReferenceWorldVixen.Assets.Tests
  • RemoteBundleSourceVixen.Assets
  • RemoteContentTestsVixen.Assets.Tests
  • RemoteWorldVixen.Assets.Tests
  • StandardFileSystemHostVixen.Platform
  • StandardFileSystemHostTestsVixen.Platform.Tests
  • StreamedContentTestsVixen.Assets.Tests
  • TemporaryFileSystemHostVixen.Platform.Headless.Tests
  • UpdateWorldVixen.Assets.Tests
  • VirtualFileSystemTestsVixen.Core.IO.Tests
  • WorldVixen.Assets.Tests
  • WorldRendererTestsVixen.Engine.Renderer.Tests
  • ChunksVixen.Editor.Assets.Tests
  • ContentBuilderTestsVixen.Editor.Assets.Tests
  • ContentMountTestsVixen.App.Tests
  • ContentServerVixen.ContentServer
  • EditorContentVixen.Editor.App
  • ImportPipelineTestsVixen.Editor.Assets.Tests
  • LooseContentTestsVixen.Editor.Assets.Tests