https://github.com/fornever/truepath
File path abstraction library for .NET.
https://github.com/fornever/truepath
dotnet file-path
Last synced: about 1 month ago
JSON representation
File path abstraction library for .NET.
- Host: GitHub
- URL: https://github.com/fornever/truepath
- Owner: ForNeVeR
- License: mit
- Created: 2022-04-20T16:46:29.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2026-03-07T00:20:04.000Z (about 1 month ago)
- Last Synced: 2026-03-07T06:29:37.754Z (about 1 month ago)
- Topics: dotnet, file-path
- Language: C#
- Homepage: https://fornever.github.io/TruePath/
- Size: 271 KB
- Stars: 99
- Watchers: 4
- Forks: 14
- Open Issues: 15
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.txt
Awesome Lists containing this project
README
TruePath [![Status Ventis][status-ventis]][andivionian-status-classifier]
========
This is a library containing a set of types to work with file system paths in .NET.
Motivation
----------
Historically, .NET has been lacking a good set of types to work with file system paths. The `System.IO.Path` class has a variety of methods that operate on path strings, but it doesn't provide any types to represent paths themselves. It's impossible to tell whether a method accepts an absolute path, a relative path, a file name, or something file-related at all, only looking at its signature: all these types are represented by plain strings. Also, comparing different paths is not straightforward.
This library aims to fill this gap by providing a set of types that represent paths in a strongly-typed way. Now, you can require a path in a method's parameters, and it is guaranteed that the passed path will be well-formed and will have certain properties.
Also, the methods in the library provide some qualities that are missing from the `System.IO.Path`: say, we aim to provide several ways of path normalization and comparison, the ones that will and will not perform disk IO to resolve paths on case-insensitive file systems.
The library is inspired by the path libraries used in other ecosystems: in particular, Java's [java.nio.file.Path][java.path] and [Kotlin's extensions][kotlin.path].
Read more on [the documentation site][docs].
If you miss some feature or have questions, do not hesitate to [open an issue][issues] or [go to the discussions section][discussions].
Packages
--------
| Name | NuGet Package | Documentation |
|-----------------------|-------------------------------------------------------------------------------------------------|--------------------------------------------|
| **TruePath** | [![TruePath on nuget.org][nuget.badge.true-path]][nuget.true-path] | [API Reference][docs.true-path] |
| **TruePath.SystemIo** | [![TruePath.SystemIo on nuget.org][nuget.badge.true-path.system-io]][nuget.true-path.system-io] | [API Reference][docs.true-path.system-io] |
| **TruePath.TestableIO.System.IO** (third-party) | [![TruePath.TestableIO.System.IO on nuget.org][nuget.badge.true-path.testableio.system-io]][nuget.true-path.testableio.system-io] | [Documentation][github.true-path.testable-io] |
TruePath provides two NuGet packages:
- [**TruePath**][nuget.true-path] for the main path abstractions,
- [**TruePath.SystemIo**][nuget.true-path.system-io] for the `System.IO` integration.
A third-party package, [**TruePath.TestableIO.System.IO**][nuget.true-path.testableio.system-io], adds [TestableIO.System.IO.Abstractions][testable-io.system.io.abstractions] integration on top of TruePath.
Documentation
-------------
- [Project Documentation Site][docs]
- [Changelog][docs.changelog]
- [Contributor Guide][docs.contributing]
- [Maintainer Guide][docs.maintaining]
License
-------
The project is distributed under the terms of [the MIT license][docs.license].
The license indication in the project's sources is compliant with the [REUSE specification v3.3][reuse.spec].
[andivionian-status-classifier]: https://andivionian.fornever.me/v1/#status-ventis-
[discussions]: https://github.com/ForNeVeR/TruePath/discussions
[docs.changelog]: CHANGELOG.md
[docs.contributing]: CONTRIBUTING.md
[docs.license]: LICENSE.txt
[docs.maintaining]: MAINTAINING.md
[docs.true-path.system-io]: https://fornever.github.io/TruePath/api/TruePath.SystemIo.html
[docs.true-path]: https://fornever.github.io/TruePath/api/TruePath.html
[docs]: https://fornever.github.io/TruePath
[github.true-path.testable-io]: https://github.com/jeppevammenkristensen/FileBasedApp.Toolkit/blob/main/Source/TruePath.TestableIO.System.IO/README.md
[issues]: https://github.com/ForNeVeR/TruePath/issues
[java.path]: https://docs.oracle.com/en%2Fjava%2Fjavase%2F21%2Fdocs%2Fapi%2F%2F/java.base/java/nio/file/Path.html
[kotlin.path]: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.io.path/java.nio.file.-path/
[nuget.badge.true-path.system-io]: https://img.shields.io/nuget/v/TruePath.SystemIo
[nuget.badge.true-path.testableio.system-io]: https://img.shields.io/nuget/v/TruePath.TestableIO.System.IO
[nuget.badge.true-path]: https://img.shields.io/nuget/v/TruePath
[nuget.true-path.system-io]: https://www.nuget.org/packages/TruePath.SystemIo
[nuget.true-path.testableio.system-io]: https://www.nuget.org/packages/TruePath.TestableIO.System.IO/
[nuget.true-path]: https://www.nuget.org/packages/TruePath
[reuse.spec]: https://reuse.software/spec-3.3/
[status-ventis]: https://img.shields.io/badge/status-ventis-yellow.svg
[testable-io.system.io.abstractions]: https://github.com/TestableIO/System.IO.Abstractions