TruePath 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package TruePath --version 1.0.0                
NuGet\Install-Package TruePath -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="TruePath" Version="1.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add TruePath --version 1.0.0                
#r "nuget: TruePath, 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.
// Install TruePath as a Cake Addin
#addin nuget:?package=TruePath&version=1.0.0

// Install TruePath as a Cake Tool
#tool nuget:?package=TruePath&version=1.0.0                

TruePath Status Ventis NuGet package

This is a library containing a set of types to work with file system paths in .NET.

Usage

The library offers several struct (i.e. low to zero memory overhead) types wrapping path strings. The types are designed to not involve any disk IO operations by default, and thus provide excellent performance during common operations. This comes with a drawback, though: path comparison is only performed as string comparison so far, which means that the library doesn't provide any means to compare paths in a case-insensitive way.

This is a subject to change in future releases, where we will provide more control over this: better platform-wide defaults (such as case-insensitive comparison on Windows and macOS), and options to enable more IO-intensive comparison (to check sensitivity settings of particular file path components during comparison). See issue #20 on the current progress on this change.

The paths are stored in the normalized form.

  • All the Path.AltDirectorySeparatorChar are converted to Path.DirectorySeparatorChar (e.g. / to \ on Windows).
  • Any repeated separators in the input are collapsed to only one separator (e.g. // to just / on Unix).
  • Any sequence of current and parent directory marks (subsequently, . and ..) is resolved if possible (meaning they will not be replaced if they are in the root position: paths such as . or ../.. will not be affected by the normalization, while e.g. foo/../. will be resolved to just foo).

Note that the normalization operation will not perform any file IO, and is purely string manipulation.

LocalPath

This is the type that may either be a relative or an absolute. Small showcase:

var myRoot = new LocalPath("foo/bar");
var fooDirectory = myRoot.Parent;

var bazSubdirectory = myRoot / "baz";
var alsoBazSubdirectory = myRoot / new LocalPath("baz");

AbsolutePath

This functions basically the same as the LocalPath, but it is always an absolute path, which is checked in the constructor.

LocalPathPattern

This is a marker type that doesn't offer any advanced functionality over the contained string. It is used to mark paths that include wildcards, for further integration with external libraries, such as Microsoft.Extensions.FileSystemGlobbing.

Documentation

License

This project's licensing follows the REUSE specification v 3.0. Consult each file's headers and the REUSE specification for possible details.

Contribution Policy

By contributing to this repository, you agree that any new files you contribute will be covered by the MIT license. If you want to contribute a file under a different license, you should clearly mark it in the file's header, according to the REUSE specification.

You are welcome to explicitly state your copyright in the file's header as described in the contributor guide, but the project maintainers may do this for you as well.

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

    • No dependencies.

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
1.6.0 459 10/6/2024
1.5.0 959 9/22/2024
1.4.0 762 8/11/2024
1.3.0 488 6/21/2024
1.2.1 146 5/25/2024
1.2.0 224 5/5/2024
1.1.0 246 4/27/2024
1.0.0 146 4/21/2024
0.0.0 121 4/20/2024

[Added]

- New types:
- LocalPath for paths that may be either absolute or relative, and stored in a normalized way;
- AbsolutePath for paths that are guaranteed (checked) to be absolute;
- LocalPathPattern (for paths including wildcards; note this is a marker type that doesn't offer any advanced functionality over the contained string).
- New static classes:
- PathStrings for path normalization (see the type's documentation on what exactly we consider as normalization).