Meziantou.Framework.FullPath 1.0.8

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

// Install Meziantou.Framework.FullPath as a Cake Tool
#tool nuget:?package=Meziantou.Framework.FullPath&version=1.0.8                

Meziantou.Framework.FullPath

FullPath ensures you always deal with full path in your application and provides many common methods to manipulate paths.

// Create FullPath
FullPath rootPath = FullPath.FromPath("demo"); // It automatically calls Path.GetFullPath to resolve the path
FullPath filePath = FullPath.Combine(rootPath, "temp", "meziantou.txt"); // Use Path.Combine to join paths (you can combine as many path as you needed)
FullPath temp = FullPath.GetTempPath(); // equivalent of Path.GetTempPath()
FullPath cwd = FullPath.GetCurrentDirectory(); // equivalent of Environment.CurrentDirectory

// Combine path: you can use the / operator to join path
FullPath filePath1 = rootPath / "temp" / "meziantou.txt";

// Compare path
// Comparisons are case-insensitive on Windows and case-sensitive on other operating systems by default
_ = filePath == rootPath;
_ = filePath.Equals(rootPath, ignoreCase: false);

// Get parent directory
FullPath parent = filePath.Parent;

// Get file/directory name - extension
var name = filePath.Name;
var ext = filePath.Extension;

// Make relative path
string relativePath = filePath.MakeRelativeTo(rootPath); // temp\meziantou.txt

// Check if a path is under another path
bool isChildOf = filePath.IsChildOf(rootPath);

// FullPath is implicitly converted to string, so it works well with File/Directory methods
System.IO.File.WriteAllText(filePath, content);

Additional resources

Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  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 was computed.  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. 
.NET Core netcoreapp3.1 is compatible. 
.NET Framework net472 is compatible.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on Meziantou.Framework.FullPath:

Package Downloads
Meziantou.Framework.TemporaryDirectory

TemporaryDirectory allows to create a disposable directory to store temporary files

Meziantou.Framework.NuGetPackageValidation

Provide rules to validate a NuGet package follows best practices

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.14 289 11/17/2024
1.0.13 8,405 5/21/2024
1.0.12 8,149 11/15/2023
1.0.11 9,964 9/7/2022
1.0.10 556 7/23/2022
1.0.9 704 5/27/2022
1.0.8 657 3/19/2022
1.0.7 5,205 7/14/2021
1.0.6 679 4/22/2021
1.0.5 560 3/3/2021
1.0.4 509 2/28/2021
1.0.3 359 1/25/2021
1.0.2 1,873 12/4/2020
1.0.1 30,308 9/25/2020
1.0.0 706 9/24/2020