public sealed class PhysicalFileProviderA directory on the real filesystem, mounted as a subtree of the virtual one.
No guide page documents this yet — the page shows what the code says about itself.
Remarks
This is the only type in the engine that is allowed to know what a platform path looks like. Everything above it says /project/Assets/x.png; the translation to a backslash, a drive letter, or a sandbox container directory happens here and nowhere else.
Case is enforced where the filesystem will not enforce it. On a case-insensitive volume — every default macOS and Windows install — asking for Texture.PNG when the file is texture.png succeeds, and keeps succeeding until someone builds on Linux. So the provider checks that the name on disk matches the name asked for, ordinally, and reports the file as missing if it does not. The check is on by default only where it is needed: the constructor probes the volume once, and on a case-sensitive filesystem it costs nothing because the kernel is already doing it.
Verified directories are cached, so the cost is one directory probe per file opened and not one per path segment. It can be turned off outright for a build that has measured it and does not want it.
Fields and properties (3)
public string RootDirectoryThe directory on disk this provider serves.
public bool IsReadOnlyWhether this provider refuses every write.
public bool EnforcesCaseSensitivityWhether names are checked against their real casing on disk.
Methods (13)
public PhysicalFileProvider(string rootDirectory, bool isReadOnly = false, bool? enforceCaseSensitivity = null)Serves a directory on disk.
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 IEnumerable<FileEntry> Enumerate(VirtualPath directory, bool recursive = false)Lists the contents of a directory.
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.
public Stream OpenWrite(VirtualPath path)Opens a file for writing, creating or truncating it.
public Stream OpenAppend(VirtualPath path)Opens a file for writing at its end, creating it if it is not there.
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 this provider can.
Used by (17)
- ProgramAddressablesRemote
- ContentMountVixen.App.Hosting
- PhysicalFileProviderConformanceVixen.Core.IO.Tests
- PhysicalFileProviderTestsVixen.Core.IO.Tests
- StandardFileSystemHostVixen.Platform
- TemporaryFileSystemHostVixen.Platform.Headless.Tests
- CompilerPoolTestsVixen.AssetCompiler.Tests
- ContentMountTestsVixen.App.Tests
- EditorContentVixen.Editor.App
- ImportPipelineTestsVixen.Editor.Assets.Tests
- LooseContentTestsVixen.Editor.Assets.Tests
- ProjectWorkspaceVixen.Editor.Assets
- SceneManifestTestsVixen.Editor.Assets.Tests
- StartupSceneTestsVixen.App.Tests
- TemporaryFileSystemHostVixen.App.Tests
- VixenCommandVixen.Cli
- WorkerHostVixen.AssetCompiler