Icod.Path 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Icod.Path --version 1.0.0
                    
NuGet\Install-Package Icod.Path -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Icod.Path" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Icod.Path" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Icod.Path" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Icod.Path --version 1.0.0
                    
#r "nuget: Icod.Path, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Icod.Path@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Icod.Path&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Icod.Path&version=1.0.0
                    
Install as a Cake Tool

Icod.Path

Icod.Path is a standalone .NET library for deterministic pathname normalization, physical canonicalization, and no-follow pathname-indirection inspection across POSIX and Windows path models.

The library is command-neutral. It can be consumed by utility suites, applications, services, build tools, or other libraries that need canonical-path behavior without depending on a command-line implementation.

What the library provides

  • PathPlatformSemantics models POSIX and Windows separators, roots, volume identity, and pathname comparison rules independently of the host operating system.
  • PathLexicalNormalizer converts input into absolute lexical form without observing the filesystem.
  • CanonicalPathResolver performs ordered physical resolution, missing-component handling, pathname-indirection traversal, relative-path calculation, and component-aware containment checks.
  • ICanonicalPathFileSystemProvider separates canonical-path policy from filesystem observation and permits deterministic or synthetic providers in tests and specialized hosts.
  • IPathIndirectionInspector and SystemPathIndirectionInspector characterize a terminal pathname object without silently dereferencing it.
  • CanonicalPathResult, RelativePathResult, PathContainmentResult, and related models return structured success or failure information instead of writing diagnostics or inventing a successful path after an error.

Canonicalization model

Lexical normalization and physical resolution are deliberately separate operations. Lexical normalization applies the selected pathname grammar without touching the filesystem. Physical resolution processes pathname components in filesystem order so supported pathname indirection is expanded before a following .., matching actual traversal semantics rather than merely simplifying text.

Missing components are controlled by MissingPathComponentPolicy:

  • RequireExisting requires every component to exist.
  • AllowFinalComponent permits only the final component to be absent.
  • AllowMissingSuffix permits a missing suffix after the last existing directory.

A failed operation returns a structured CanonicalPathFailure. Unresolved input is never reported as a successful canonical pathname.

Windows reparse points are not treated as synonyms for symbolic links. The system inspector preserves the raw reparse tag, Microsoft and name-surrogate bits, physical attributes, decoded targets where supported, mounted-volume identity where available, and recall/offline indicators.

The model distinguishes POSIX and Windows symbolic links, directory junctions, mounted volumes, other name-surrogate reparse points, Cloud Files placeholders, opaque reparse points, and unknown host indirection. The resolver follows only mechanisms whose targets can be characterized safely as pathnames.

Basic use

using Icod.Path;

var resolver = new CanonicalPathResolver();
var result = await resolver.ResolvePhysicalAsync( inputPath );

if ( result.Succeeded ) {
    Console.WriteLine( result.Path );
} else {
    Console.Error.WriteLine( result.Failure?.Message );
}

Use NormalizeLexically when filesystem observation is not desired, InspectLinkAsync for no-follow terminal-object inspection, GetRelativePath for component-aware relative paths, and EvaluateContainment for root/candidate containment checks.

Platform profile

The same pathname grammar can be selected independently of the current host for deterministic tests and tooling. POSIX paths use /, a single root, and ordinal case-sensitive comparison. Windows paths recognize drive roots, UNC roots, current-volume rooted paths, and extended path prefixes and use ordinal case-insensitive root and component comparison.

System-backed physical observation uses the current host filesystem. On Windows, reparse-point characterization uses no-follow handles and native reparse metadata; on POSIX hosts, symbolic-link targets are observed without resolving the entire link chain in one step.

Build and test

Icod.Path targets .NET 10.0 and uses C# 13.

dotnet build Icod.Path.sln
dotnet test Icod.Path.sln

The repository contains the library project at the root and its test project under tests/Path.Tests.

Detailed contract

See src/README.md for the canonical-path, pathname-indirection, and platform contract implemented by the source tree.

License

Icod.Path is licensed under the GNU Lesser General Public License, version 3.0 or later. See LICENSE.

Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  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 is compatible.  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 is compatible.  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 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.0

    • No dependencies.
  • net7.0

    • No dependencies.
  • net8.0

    • No dependencies.
  • net9.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Icod.Path:

Package Downloads
Icod.CommandFramework

Cross-platform .NET infrastructure for Unix-style command-line tools, including argument parsing, diagnostics, byte-oriented streaming, filesystem operations, records, GNU/POSIX regular expressions, temporary storage, and Unicode text.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.1.0 2,040 8/29/2026
1.0.1 85 8/25/2026
1.0.0 2,141 8/20/2026

Canonical-path foundation release