ktsu.StrongPaths 1.1.50

Prefix Reserved
dotnet add package ktsu.StrongPaths --version 1.1.50                
NuGet\Install-Package ktsu.StrongPaths -Version 1.1.50                
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="ktsu.StrongPaths" Version="1.1.50" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ktsu.StrongPaths --version 1.1.50                
#r "nuget: ktsu.StrongPaths, 1.1.50"                
#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 ktsu.StrongPaths as a Cake Addin
#addin nuget:?package=ktsu.StrongPaths&version=1.1.50

// Install ktsu.StrongPaths as a Cake Tool
#tool nuget:?package=ktsu.StrongPaths&version=1.1.50                

StrongPaths

A library that provides strong typing for common filesystem paths providing compile time feedback and runtime validation.

StrongPaths is a collection of classes derived from ktsu.StrongStrings with added functionality and helper methods for filesystem paths.

Get familiar with the StrongStrings library to get the most out of StrongPaths.

Usage

using ktsu.StrongPaths;

public class MyDemoClass
{
	public AbsoluteDirectoryPath OutputDir { get; set; } = (AbsoluteDirectoryPath)@"c:\output";

	public void SaveData(RelativeDirectoryPath subDir, FileName fileName)
	{
		// You can use the / operator to combine paths
		AbsoluteFilePath filePath = OutputDir / subDir / fileName;
		File.WriteAllText(filePath, "Hello, world!");

		// An AbsoluteDirectoryPath combined with a RelativeDirectoryPath returns an AbsoluteDirectoryPath
		AbsoluteDirectoryPath newOutputDir = OutputDir / subDir;

		// An AbsoluteDirectoryPath combined with a FileName returns an AbsoluteFilePath
		AbsoluteFilePath newFilePath = newOutputDir / fileName;

		// You can get a relative path from Absolute/Relative Directory/File paths using the RelativeTo method
		RelativeDirectoryPath relativePath = newOutputDir.RelativeTo(OutputDir);
		RelativeFilePath relativeFilePath = newFilePath.RelativeTo(OutputDir);
		RelativeDirectoryPath relativePath2 = newOutputDir.RelativeTo(filePath);
		RelativeFilePath relativeFilePath2 = newFilePath.RelativeTo(filePath);
	}

	public void Demo()
	{
		string storeLocation = "melbourne";
		RelativeDirectoryPath storeDir = (RelativeDirectoryPath)$"store_{storeLocation}";
		FileName fileName = (FileName)$"{DateTime.UtcNow}.json";
		SaveData(storeDir, fileName);
	}
}

Concrete Types

  • AbsolutePath
  • RelativePath
  • DirectoryPath
  • FilePath
  • FileName
  • FileExtension
  • AbsoluteDirectoryPath
  • RelativeDirectoryPath
  • AbsoluteFilePath
  • RelativeFilePath

Abstract Base Classes

You can use these abstract base classes to accept a subset of path types in your method parameters:

  • AnyStrongPath Accepts any of the concrete types and types derived from them
  • AnyRelativePath Accepts RelativePath, RelativeDirectroryPath, RelativeFilePath, and types derived from them
  • AnyAbsolutePath Accepts AbsolutePath, AbsoluteDirectroryPath, AbsoluteFilePath, and types derived from them
  • AnyDirectoryPath Accepts DirectoryPath, AbsoluteDirectroryPath, RelativeDirectroryPath, and types derived from them
  • AnyFilePath Accepts FilePath, AbsoluteFilePath, RelativeFilePath, and types derived from them
using ktsu.StrongPaths;

public static class MyDemoClass
{
	public static void SaveData(AnyDirectoryPath outputDir, FileName fileName)
	{
		// You can't use the / operator with the abstract base classes because it has no way of knowing which type to return
		// You have to use the Path.Combine method when using the abstract base classes
		FilePath filePath = (FilePath)Path.Combine(outputDir, fileName);
		File.WriteAllText(filePath, "Hello, World!");
	}

    public static void Demo()
	{
		string storeLocation = "melbourne";
		RelativeDirectoryPath storeDir = (RelativeDirectoryPath)$"store_{storeLocation}";
		FileName fileName = (FileName)$"{DateTime.UtcNow}.json";
		SaveData(storeDir, fileName);
	}
}
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.  net9.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (7)

Showing the top 5 NuGet packages that depend on ktsu.StrongPaths:

Package Downloads
ktsu.AppDataStorage

Application data management library using JSON serialization to save and load data in the user's app data folder.

ktsu.ImGuiWidgets

A library of custom widgets using ImGui.NET and utilities to enhance ImGui-based applications.

ktsu.ImGuiPopups

A library for custom popups using ImGui.NET.

ktsu.ImGuiApp

A bootstrap library to give you an environment to build an ImGUI.NET application with.

ktsu.CredentialCache

CredentialCache

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.1.50 95 1/2/2025
1.1.50-pre.9 0 1/6/2025
1.1.50-pre.8 51 1/4/2025
1.1.50-pre.7 39 1/3/2025
1.1.50-pre.6 38 1/3/2025
1.1.50-pre.5 38 1/3/2025
1.1.50-pre.4 56 1/1/2025
1.1.50-pre.3 64 12/31/2024
1.1.50-pre.2 44 12/29/2024
1.1.50-pre.1 38 12/28/2024
1.1.49 551 12/26/2024
1.1.48 72 12/26/2024
1.1.47 77 12/26/2024
1.1.46 77 12/26/2024
1.1.45 79 12/26/2024
1.1.44 76 12/26/2024
1.1.43 88 12/26/2024
1.1.42 234 12/25/2024
1.1.41 294 12/24/2024
1.1.40 317 12/23/2024
1.1.39 80 12/23/2024
1.1.38 76 12/23/2024
1.1.37 578 12/19/2024
1.1.36 396 12/14/2024
1.1.35 477 12/6/2024
1.1.34 222 12/5/2024
1.1.33 412 12/2/2024
1.1.32 294 12/2/2024
1.1.31 264 12/1/2024
1.1.30 130 12/1/2024
1.1.29 144 11/30/2024
1.1.28 83 11/30/2024
1.1.27 98 11/30/2024
1.1.26 134 11/29/2024
1.1.25 199 11/28/2024
1.1.24 250 11/26/2024
1.1.23 572 11/15/2024
1.1.22 212 11/14/2024
1.1.21 202 11/13/2024
1.1.20 541 11/5/2024
1.1.19 240 11/2/2024
1.1.18 293 11/1/2024
1.1.17 792 10/17/2024
1.1.16 516 10/8/2024
1.1.15 227 10/5/2024
1.1.14 182 10/4/2024
1.1.13 518 9/24/2024
1.1.12 206 9/21/2024
1.1.11 211 9/19/2024
1.1.10 160 9/19/2024
1.1.9 160 9/19/2024
1.1.8 97 9/19/2024
1.1.7 155 9/19/2024
1.1.6 115 9/18/2024
1.1.5 102 9/18/2024
1.1.4 246 9/18/2024
1.1.3 357 9/18/2024
1.1.2 364 9/14/2024

## v1.1.50 (unknown)

Changes since v1.1.50-pre.4:

- Add automation scripts for metadata management and versioning ([@Matthew Edmondson](https://github.com/Matthew Edmondson))

## v1.1.50-pre.1 (patch)

Changes since v1.1.49:

- Renamed metadata files ([@Matthew Edmondson](https://github.com/Matthew Edmondson))

## v1.1.45 (patch)

Changes since v1.1.44:

- Replace LICENSE file with LICENSE.md and update copyright information ([@Matthew Edmondson](https://github.com/Matthew Edmondson))

## v1.1.38 (patch)

Changes since v1.1.37:

- Refactor test assertions in Tests.cs ([@Matthew Edmondson](https://github.com/Matthew Edmondson))
- Update StrongStrings subproject reference ([@Matthew Edmondson](https://github.com/Matthew Edmondson))

## v1.1.29 (patch)

Changes since v1.1.28:

- Ensure paths are fully qualified in IsValid method ([@Matthew Edmondson](https://github.com/Matthew Edmondson))

## v1.1.28 (patch)

Changes since v1.1.27:

- Refactor MakeCanonical and update Tests.cs namespace ([@Matthew Edmondson](https://github.com/Matthew Edmondson))

## v1.1.2 (minor)

Changes since v1.0.8:

- Add WithFilePrefix ([@Matt Edmondson](https://github.com/Matt Edmondson))
- Fix crash when using prefix/suffix methods ([@Matt Edmondson](https://github.com/Matt Edmondson))
- Migrate ktsu.io to ktsu namespace ([@Matt Edmondson](https://github.com/Matt Edmondson))

## v1.0.8 (major)

Changes since 0.0.0.0:

- Add a property to get the filesystem contents from directories ([@matt-edmondson](https://github.com/matt-edmondson))
- Add github package support ([@matt-edmondson](https://github.com/matt-edmondson))
- Add helper properties to top level paths ([@matt-edmondson](https://github.com/matt-edmondson))
- Add IsDirectory  and IsFile  properties ([@matt-edmondson](https://github.com/matt-edmondson))
- Add path combine operators to common path types ([@matt-edmondson](https://github.com/matt-edmondson))
- Add RelativeTo helper methods ([@matt-edmondson](https://github.com/matt-edmondson))
- Add some common path types like absolute and relative file and directory paths ([@matt-edmondson](https://github.com/matt-edmondson))
- Adjust unit test to work on linux ([@Matthew Edmondson](https://github.com/Matthew Edmondson))
- Allow paths to be empty ([@matt-edmondson](https://github.com/matt-edmondson))
- Assign dependabot PRs to matt ([@matt-edmondson](https://github.com/matt-edmondson))
- Avoid double upload of symbols package ([@matt-edmondson](https://github.com/matt-edmondson))
- Bump version to 1.0.0-alpha.2 ([@Matt Edmondson](https://github.com/Matt Edmondson))
- Chnage path separators to make code gen work on github ([@Matthew Edmondson](https://github.com/Matthew Edmondson))
- Create dependabot-merge.yml ([@matt-edmondson](https://github.com/matt-edmondson))
- Create VERSION ([@matt-edmondson](https://github.com/matt-edmondson))
- Don't crash when trying to get the contents of an unauthorized directory, just return nothing instead ([@matt-edmondson](https://github.com/matt-edmondson))
- Dont try to push packages when building pull requests ([@matt-edmondson](https://github.com/matt-edmondson))
- Enable dependabot and sourcelink ([@matt-edmondson](https://github.com/matt-edmondson))
- Fix issue with RelativeTo not working correctly and add additional unit tests ([@matt-edmondson](https://github.com/matt-edmondson))
- Fix style warnings for ArgumentNullException.ThrowIfNull and take latest StrongStrings ([@Matt Edmondson](https://github.com/Matt Edmondson))
- Fixed an issue where a directory in the CWD that had periods in the name would not validate as a directory path. Also code style cleanup. ([@matt-edmondson](https://github.com/matt-edmondson))
- Initial WIP commit ([@matt-edmondson](https://github.com/matt-edmondson))
- Make the RelativePath Make method public Add a FileName property to AnyStrongPath Take latest StrongStrings ([@matt-edmondson](https://github.com/matt-edmondson))
- Make unit tests work on linux ([@Matthew Edmondson](https://github.com/Matthew Edmondson))
- Make unit tests work with linux ([@Matthew Edmondson](https://github.com/Matthew Edmondson))
- Migrate from .project.props to Directory.Build.props ([@matt-edmondson](https://github.com/matt-edmondson))
- Move some file specific properties into AnyFilePath add a DirectoryPath property to FilePath ([@matt-edmondson](https://github.com/matt-edmondson))
- Read from AUTHORS file during build ([@matt-edmondson](https://github.com/matt-edmondson))
- Read from VERSION when building ([@matt-edmondson](https://github.com/matt-edmondson))
- Read PackageDescription from DESCRIPTION file ([@matt-edmondson](https://github.com/matt-edmondson))
- Readd strongstrings so that we can share the csx scripts it uses for code generation ([@matt-edmondson](https://github.com/matt-edmondson))
- Refactor AnyFilePath and update StrongStrings ([@matt-edmondson](https://github.com/matt-edmondson))
- Take latest StrongStrings ([@matt-edmondson](https://github.com/matt-edmondson))
- Update build config ([@matt-edmondson](https://github.com/matt-edmondson))
- Update Directory.Build.props ([@matt-edmondson](https://github.com/matt-edmondson))
- Update Directory.Build.targets ([@matt-edmondson](https://github.com/matt-edmondson))
- Update dotnet.yml ([@matt-edmondson](https://github.com/matt-edmondson))
- Update LICENSE ([@matt-edmondson](https://github.com/matt-edmondson))
- Update nuget.config ([@matt-edmondson](https://github.com/matt-edmondson))
- Update readme and description ([@matt-edmondson](https://github.com/matt-edmondson))
- Update README.md ([@matt-edmondson](https://github.com/matt-edmondson))
- Update StrongStrings ([@matt-edmondson](https://github.com/matt-edmondson))
- Use code generation to make all the user facing classes and add some unit tests ([@matt-edmondson](https://github.com/matt-edmondson))
- Use package reference instead of project reference to StrongStrings ([@Matt Edmondson](https://github.com/Matt Edmondson))
- WIP ([@Matthew Edmondson](https://github.com/Matthew Edmondson))
- WIP while trying to figure out the use cases for StrongStrings ([@Matthew Edmondson](https://github.com/Matthew Edmondson))