Olve.Paths 0.38.0

dotnet add package Olve.Paths --version 0.38.0
                    
NuGet\Install-Package Olve.Paths -Version 0.38.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="Olve.Paths" Version="0.38.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Olve.Paths" Version="0.38.0" />
                    
Directory.Packages.props
<PackageReference Include="Olve.Paths" />
                    
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 Olve.Paths --version 0.38.0
                    
#r "nuget: Olve.Paths, 0.38.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 Olve.Paths@0.38.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=Olve.Paths&version=0.38.0
                    
Install as a Cake Addin
#tool nuget:?package=Olve.Paths&version=0.38.0
                    
Install as a Cake Tool

Olve.Paths

NuGet Docs

A .NET library for working with file and directory paths inspired by Python's pathlib module. It provides an object-oriented interface for manipulating paths in a more intuitive way than raw strings.


Installation

dotnet add package Olve.Paths

Overview

Type Description
IPath Environment-aware path with filesystem operations (existence checks, children, element type).
IPurePath Immutable, pure path independent of the filesystem. Useful for manipulation without side effects.
PathPlatform Platform discriminator: Unix or Windows.
ElementType Filesystem element type: File, Directory, or None.
PathType Path classification: Absolute, Relative, or Stub.

Usage

Path navigation

Create a path with Path.Create() and navigate using Parent, Name, and the / operator for joining.

// ../../tests/Olve.Paths.Tests/ReadmeDemo.cs#L8-L14

var path = Path.Create("/home/user/documents"); // /home/user/documents

var parent = path.Parent; // /home/user
var folderName = path.Name; // documents

var newPath = path / "newfile.txt"; // /home/user/documents/newfile.txt
var exists = newPath.Exists(); // Check if the file exists

On Windows the same API applies with backslash-separated paths:

// ../../tests/Olve.Paths.Tests/ReadmeDemo.cs#L28-L34

var path = Path.Create(@"C:\users\user\documents"); // C:\users\user\documents

var parent = path.Parent; // C:\users\user
var folderName = path.Name; // documents

var newPath = path / "newfile.txt"; // C:\users\user\documents\newfile.txt
var exists = newPath.Exists(); // Check if the file exists

Pure paths

Path.CreatePure() creates immutable paths that work on any platform without touching the filesystem. Pass a PathPlatform to create paths for a specific platform regardless of the host OS.

// ../../tests/Olve.Paths.Tests/ReadmeDemo.cs#L48-L53

// Pure paths allow platform-independent path manipulation
var unixPath = Path.CreatePure("/home/user/docs", PathPlatform.Unix);
var windowsPath = Path.CreatePure(@"C:\users\user\docs", PathPlatform.Windows);

var unixPlatform = unixPath.Platform; // PathPlatform.Unix
var windowsPlatform = windowsPath.Platform; // PathPlatform.Windows

Filesystem operations

IPath provides methods for querying and manipulating the filesystem: Exists(), ElementType, TryGetChildren(), and EnsurePathExists().

// ../../tests/Olve.Paths.Tests/ReadmeDemo.cs#L65-L76

// Filesystem operations
var tempDir = Path.CreateTempDirectory("olve-paths-demo-"); // Creates a unique temp directory
var exists = tempDir.Exists(); // true
var elementType = tempDir.ElementType; // ElementType.Directory

if (tempDir.TryGetChildren(out var children))
{
    foreach (var child in children)
    {
        Console.WriteLine(child.Path);
    }
}

Temporary paths

Path wraps .NET's temporary path APIs and returns IPath objects. GetTempDirectory() returns the system temp directory, CreateTempDirectory() creates a unique subdirectory, and CreateTempFile() creates a unique zero-byte file.

// ../../tests/Olve.Paths.Tests/ReadmeDemo.cs#L89-L92

// Temporary paths
var tempDir = Path.GetTempDirectory(); // System temp directory
var tempSubDir = Path.CreateTempDirectory("my-app-"); // Unique temp subdirectory
var tempFile = Path.CreateTempFile(); // Unique temp file

Globbing

See Olve.Paths.Glob for wildcard pattern matching on paths.


Documentation

Full API reference: https://olivervea.github.io/Olve.Utilities/api/Olve.Paths.html


License

MIT License © OliverVea

Product Compatible and additional computed target framework versions.
.NET 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.

NuGet packages (3)

Showing the top 3 NuGet packages that depend on Olve.Paths:

Package Downloads
Olve.Utilities

Various pieces of utility

Olve.Results

Result type implementation and utilities

Olve.Paths.Glob

Olve.Paths.Glob is a library that provides a set of utilities for working with Olve.Paths paths and glob patterns.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.38.0 556 2/19/2026
0.37.2 156 2/18/2026
0.37.1 150 2/18/2026
0.37.0 147 2/17/2026
0.36.1 439 11/15/2025
0.36.0 261 11/15/2025
0.35.2 252 11/9/2025
0.35.1 231 11/8/2025
0.35.0 216 11/8/2025
0.34.0 237 10/4/2025
0.33.0 209 9/13/2025
0.32.2 279 8/9/2025
0.32.1 260 8/9/2025
0.32.0 314 8/8/2025
0.31.0 383 8/5/2025
0.30.0 162 8/3/2025
0.29.1 163 8/3/2025
0.29.0 152 8/3/2025
0.28.2 144 8/2/2025
0.26.2 587 7/21/2025
Loading failed