Deficuet.APFS
0.0.1-alpha.14
dotnet add package Deficuet.APFS --version 0.0.1-alpha.14
NuGet\Install-Package Deficuet.APFS -Version 0.0.1-alpha.14
<PackageReference Include="Deficuet.APFS" Version="0.0.1-alpha.14" />
<PackageVersion Include="Deficuet.APFS" Version="0.0.1-alpha.14" />
<PackageReference Include="Deficuet.APFS" />
paket add Deficuet.APFS --version 0.0.1-alpha.14
#r "nuget: Deficuet.APFS, 0.0.1-alpha.14"
#:package Deficuet.APFS@0.0.1-alpha.14
#addin nuget:?package=Deficuet.APFS&version=0.0.1-alpha.14&prerelease
#tool nuget:?package=Deficuet.APFS&version=0.0.1-alpha.14&prerelease
APFS — AzurPromilia Package File System
A read-only virtual file system for game asset packages, built on ROVFS (and therefore WinFsp). APFS is the data manager implementation: it maps a JSON-describable asset tree onto flat, case-insensitive lookup maps and serves reads from segmented package files.
Concepts
| Type | Role |
|---|---|
SegmentedFileData |
Population-phase file entry: the physical segment (PackageName, ResSubPath, PathType, Offset, Size). It carries no virtual-name metadata — the caller computes the final file name. Immutable; equality is physical identity only. |
SegmentedFileEntry |
Finalized file entry that is persisted in the JSON: PackageName, ResSubPath, PathType, Offset, Size, IndexNumber. Only physical fields survive. |
DirectoryData |
Population-phase (intermediate) directory node holding Files (SegmentedFileData per formal name), AliasPaths (lookup-only path → SegmentedFileData, registered on the node the adding call was made on) and Directories, all in case-insensitive dictionaries. |
DirectoryView |
Static (final) directory: natural-sort-ordered EntryInfo<string>[]; the case-insensitive name→index map is derived from it and rebuilt after deserialization. Win32 wildcard matching is built in. |
AzurPromiliaFileDataManager |
The ROVFS data manager: path resolution, directory contexts, backing file handles, and FileInfo assembly. |
Population workflow
The manager follows a populate first, mount once, never modify lifecycle. Entry and directory objects are created outside this project; after population they are handed to the manager, and the manager can be serialized to / deserialized from JSON (also outside this project) for persistence.
Create a root
DirectoryDatainstance acting as the volume root.For every file call
root.AddFile(path, entry, alias).pathis one or more formal paths (at least one is required),aliasis zero or more lookup-only alias paths and may be omitted. Every path is relative to the node, separated by/or\, and never starts or ends with a separator; missing intermediate directories are created implicitly (case-insensitively merged).The caller owns the virtual names: the final file name — including any uniqueness suffix — must already be in the formal path. Nothing is rewritten or suffixed here:
var hero = new SegmentedFileData( packageName: "pkg001", resSubPath: "characters/hero/hero.bin", pathType: PathType.Static, offset: 0, size: 1048576); root.AddFile( new[] { "characters/hero/hero.bin$3f2a9c1d_42.bin", // formal path (enumerated) "__per_pkg/pkg001/characters/hero/hero.bin$3f2a9c1d_42.bin", // per-package mirror (enumerated) }, hero, new[] { "characters/hero/hero.bin" }); // alias (lookup only)The same physical entry may be added under several formal paths (for example a normal path and a per-package mirror);
AddFileTreecollapses those occurrences, like hard links. Formal paths and aliases are handled independently: the formal paths create the folders and the enumerated entries, while the aliases are registered on the node the call was made on (DirectoryData.AliasPaths) and never create anything themselves. An entry therefore always needs at least one formal path, and a mirrored formal path never duplicates the aliases.Call
manager.AddFileTree(root). This traverses the tree breadth-first, finalizes every node into aDirectoryView, assigns a uniqueIndexNumberto every directory and every unique physical entry, accumulatesTotalSizeonce per unique entry, and fills the flat maps:PathFileMap[fullPath] = indexfor every formal path (all paths of one entry share the index);Entries[index]is the finalizedSegmentedFileEntry;- after every formal path is indexed, each registered alias is prefixed with the path of the node
that registered it (in practice the volume root) and added to
PathFileMaponly. An alias is therefore never in aDirectoryViewand never shows up in a directory listing; a path already indexed by a different entry is logged and skipped. Aliases that resolve through a path which is not an enumerated directory are counted and reported once at the end of the build, not per path.
Mount.
AddFileTreemay be called exactly once; the internal maps must not be modified afterwards.
Full paths are rooted at \ and use \ separators — exactly the form WinFsp passes to the file
system, regardless of whether the volume is mounted on a drive letter or into a folder.
All lookups use StringComparer.OrdinalIgnoreCase dictionaries, matching the case-insensitive
volume flag applied by ROVFS. TryCheckNodeExists checks directories before files, so an alias can
never shadow a real folder.
Formal paths vs. alias paths
| Formal path | Alias path | |
|---|---|---|
| Passed as | path array (AddFile) |
alias array (AddFile) |
| Resolved relative to | the node AddFile was called on |
the same node (never the folder that ends up holding the file) |
| Stored in | DirectoryData.Files of the folders it names |
DirectoryData.AliasPaths of the call node |
Lives in DirectoryView |
yes | no |
Visible to ReadDirectory / Explorer listing |
yes | no |
Resolvable by exact path (GetSecurityByName, Open) |
yes | yes |
| Creates an entry | yes (first occurrence) | never |
| Creates directories | yes (implicitly) | never |
Both kinds end up as keys of the same PathFileMap pointing at one Entries[i]; the only difference
is that a formal path also contributed an EntryInfo to its DirectoryView. Because aliases create no
directories, an alias may name a path whose parent folder does not exist — the file stays openable by
its exact path but the folder itself is not browsable (such aliases are counted and reported once at
the end of the build).
Alias paths are normalized to \ separators when they are registered, because that is the form WinFsp
passes in. A second entry claiming an already registered alias path is logged and dropped (first one
wins); re-registering the same path for the same entry is ignored.
Persisted JSON shape
AzurPromiliaFileDataManager persists PathFileMap (path → int), PathDirectoryMap
(path → DirectoryView) and Entries (SegmentedFileEntry[]). DirectoryView.EntryIndexMap is
[JsonIgnore] and rebuilt in [OnDeserialized], so it is not part of the file. The JSON has no
schema version: after changing the manager's shape, delete and rebuild the file.
Backing files
| PathType | Physical location |
|---|---|
Static |
{RootDirectoryPath}\StreamingAssets\.res\{PackageName}\{ResSubPath} |
Cache |
{RootDirectoryPath}\.res\{PackageName}\BundleFiles\{ResSubPath} |
RootDirectoryPath must not end with a separator. It is not part of the persisted JSON state
([JsonIgnore]): the host supplies it after deserialization (the APFS service passes it on the
command line). Handles are opened read-only with FILE_FLAG_OVERLAPPED, so multiple segments of the same package can be read concurrently through independent handles. A missing or unreadable backing file is logged and mapped to a Win32-derived NT status.
Mounting example
var manager = new AzurPromiliaFileDataManager
{
RootDirectoryPath = rootDirectoryPath, // supplied by the host; not persisted in JSON
GlobalTimestamp = volumeCreationFileTime,
};
manager.PackageTimestampMap["pkg001"] = packageFileTime;
manager.AddFileTree(root); // populated tree from the steps above
var fileSystem = new ReadOnlyFileSystem<
SegmentedFileEntry, DirectoryView, SafeFileHandle, string, string>(manager);
var host = new FileSystemHost(fileSystem);
host.Mount("X:"); // or host.Mount(@"C:\Some\NotYetExisting\Folder");
Dependencies
- Deficuet.ROVFS
0.0.1-alpha.16 NaturalSort.Extension4.4.1Newtonsoft.Json13.0.4(used for the[JsonIgnore]/[OnDeserialized]annotations)System.Text.Encoding.CodePages8.0.0- WinFsp
2.1must be installed on the machine.
Both libraries target netstandard2.0; Deficuet.ROVFS transitively brings in System.Memory, which Unity consumers must also ship.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Deficuet.ROVFS (>= 0.0.1-alpha.16)
- NaturalSort.Extension (>= 4.4.1)
- Newtonsoft.Json (>= 13.0.4)
- System.Text.Encoding.CodePages (>= 8.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.0.1-alpha.14 | 46 | 11/25/2026 |
| 0.0.1-alpha.13 | 48 | 11/25/2026 |
| 0.0.1-alpha.12 | 42 | 11/25/2026 |
| 0.0.1-alpha.11 | 52 | 11/25/2026 |
| 0.0.1-alpha.10 | 73 | 10/27/2026 |
| 0.0.1-alpha.9 | 69 | 10/23/2026 |
| 0.0.1-alpha.8 | 70 | 10/20/2026 |
| 0.0.1-alpha.7 | 66 | 10/18/2026 |
| 0.0.1-alpha.6 | 68 | 10/16/2026 |
| 0.0.1-alpha.5 | 63 | 10/15/2026 |
| 0.0.1-alpha.4 | 106 | 9/13/2026 |
| 0.0.1-alpha.3 | 88 | 9/13/2026 |
| 0.0.1-alpha.2 | 102 | 9/8/2026 |
| 0.0.1-alpha.1 | 93 | 9/8/2026 |