PlatformAPI reference
Class FolderContentSource
Namespace: MicroEngine.Platform
Assembly: MicroEngine.Platform.dll
Guide: The platform host
Content files in a folder on disk. Names must match the files’ letter case exactly on every system: “Hero.png” for
“hero.png” works on Windows and macOS but not on Linux, Android or in browsers, so it fails everywhere, naming the
real spelling. Paths that leave the folder (.., another drive) are refused.
public sealed class FolderContentSource : IContentSourceInheritance
Implements
Remarks
Safe to read from several threads (asset workers check names concurrently).
Constructors
FolderContentSource(string)
Opens a folder.
public FolderContentSource(string root)Parameters
root string
The folder, absolute or relative to the working directory.
Exceptions
root is null, empty or white space.
The folder does not exist.
Properties
Location
The same as Root.
public string Location { get; }Property Value
Root
The absolute path of the folder.
public string Root { get; }Property Value
Methods
Exists(string)
Whether a file exists at path. False for a missing file and for a path outside the source.
public bool Exists(string path)Parameters
path string
Returns
Files(string)
The files directly inside folder (“” for the top), as paths relative to the source, in ordinal order.
public IReadOnlyList<string> Files(string folder)Parameters
folder string
Returns
Exceptions
The folder does not exist.
Open(string)
Opens the file at path for reading; the caller disposes the stream.
public Stream Open(string path)Parameters
path string
Returns
Exceptions
The path leaves the source.
No such file, or its name is spelled with another letter case.
PathOf(string)
The full path of the file at path, after the checks of Open.
public string PathOf(string path)Parameters
path string
Returns
Exceptions
The path leaves the folder.
No such file, or its name is spelled with another letter case.