Class FileSystemIncludePathCanonicalizer
- Namespace
- ShadowDusk.Core.Preprocessor
- Assembly
- ShadowDusk.Core.dll
The disk-backed IIncludePathCanonicalizer: walks a path segment by segment and asks the file system for each segment's real name.
public sealed class FileSystemIncludePathCanonicalizer : IIncludePathCanonicalizer
- Inheritance
-
FileSystemIncludePathCanonicalizer
- Implements
- Inherited Members
Remarks
Read-only by construction — it enumerates, it never creates a probe file, so it works on a read-only volume and leaves nothing behind.
Each segment is looked up with CaseInsensitive so a
wrong-cased request still finds the real entry, and an exact ordinal match always wins
over a case-insensitive one. That second rule is what makes this correct on a case-sensitive
volume that genuinely holds both Common.fxh and common.fxh: each spelling
canonicalizes to itself instead of collapsing onto whichever the directory listed first.
Results are cached per full path for the process lifetime. Include trees do not change during a compile, and the cache keeps a deep include chain from re-enumerating its shared prefix once per file.
Properties
Instance
The shared instance used by Preprocessor when none is injected.
public static FileSystemIncludePathCanonicalizer Instance { get; }
Property Value
Methods
TryGetOnDiskPath(string)
Returns path re-spelled exactly as the storage holding it spells it,
or null when that cannot be determined (the path does not exist, it is
a virtual name with no backing store, or the lookup failed).
public string? TryGetOnDiskPath(string path)
Parameters
pathstringA resolved path, as produced by an IIncludeResolver.