public interface IFileProviderOne source of files, mounted somewhere in the virtual file system.
No guide page documents this yet — the page shows what the code says about itself.
Remarks
Paths passed to a provider are relative to its mount and still rooted: a provider mounted at /app sees /textures/a.png when the caller asked for /app/textures/a.png. A provider therefore does not know or care where it is mounted, which is what lets the same physical provider serve /project in the editor and /app in a build.
Async-first, with sync as a documented compromise. Opening a stream is the operation that is genuinely remote on some platforms — a browser fetch, a bundle that has to be downloaded — so it is asynchronous and everything in the runtime uses that form. The synchronous overloads exist because editor and tooling code is full of straight-line file work that would be worse as a state machine, and they are implemented here by blocking on the asynchronous ones. A provider that can do better should override them; PhysicalFileProvider does.
Enumeration is synchronous only. It is a metadata query, and every provider that exists or is planned answers it from something local: a directory, a dictionary, or a bundle catalog that was loaded when the bundle was. Adding an asynchronous form now would be adding a state machine to satisfy no caller.
Fields and properties (1)
bool IsReadOnlyWhether this provider refuses every write.
Methods (12)
bool Exists(VirtualPath path)Whether a file or directory exists.
bool TryGetEntry(VirtualPath path, out FileEntry entry)Reads what is known about a file or directory without opening it.
IEnumerable<FileEntry> Enumerate(VirtualPath directory, bool recursive = false)Lists the contents of a directory.
ValueTask<Stream> OpenReadAsync(VirtualPath path, CancellationToken cancellationToken = default(CancellationToken))Opens a file for reading.
ValueTask<Stream> OpenWriteAsync(VirtualPath path, CancellationToken cancellationToken = default(CancellationToken))Opens a file for writing, creating or truncating it.
ValueTask<Stream> OpenAppendAsync(VirtualPath path, CancellationToken cancellationToken = default(CancellationToken))Opens a file for writing at its end, creating it if it is not there.
bool Delete(VirtualPath path)Deletes a file, or an empty directory.
void CreateDirectory(VirtualPath path)Creates a directory and any missing parents.
Stream OpenRead(VirtualPath path)Opens a file for reading.
Stream OpenWrite(VirtualPath path)Opens a file for writing, creating or truncating it.
Stream OpenAppend(VirtualPath path)Opens a file for writing at its end, creating it if it is not there.
bool TryMap(VirtualPath path, out IMappedFile? mapped)Maps a file into memory, if this provider can.
Used by (22)
- FileProviderConformanceVixen.Core.IO.Tests
- MemoryFileProviderVixen.Core.IO
- MemoryFileProviderConformanceVixen.Core.IO.Tests
- MinimalFileProviderConformanceVixen.Core.IO.Tests
- MinimalProviderVixen.Core.IO.Tests
- MountEntryVixen.Core.IO
- PhysicalFileProviderVixen.Core.IO
- PhysicalFileProviderConformanceVixen.Core.IO.Tests
- PhysicalFileProviderTestsVixen.Core.IO.Tests
- VirtualFileSystemVixen.Core.IO
- VirtualFileSystemTestsVixen.Core.IO.Tests
- DeclaredReadsOnlyProviderVixen.Editor.Assets
- ImportContextVixen.Editor.Assets
- ImportPipelineVixen.Editor.Assets
- ImportPipelineTestsVixen.Editor.Assets.Tests
- ImporterTestsVixen.Editor.Assets.Tests
- InProcessImportExecutorVixen.Editor.Assets
- NavMeshImporterVixen.Editor.Assets
- PaletteImporterVixen.Editor.Assets.Tests
- ProjectVixen.Cli
- ProjectWorkspaceVixen.Editor.Assets
- ProxyShapeSetImporterVixen.Editor.Assets