dotnet add package Meziantou.Framework.FullPath --version 1.0.11
NuGet\Install-Package Meziantou.Framework.FullPath -Version 1.0.11
<PackageReference Include="Meziantou.Framework.FullPath" Version="1.0.11" />
paket add Meziantou.Framework.FullPath --version 1.0.11
#r "nuget: Meziantou.Framework.FullPath, 1.0.11"
// Install Meziantou.Framework.FullPath as a Cake Addin #addin nuget:?package=Meziantou.Framework.FullPath&version=1.0.11 // Install Meziantou.Framework.FullPath as a Cake Tool #tool nuget:?package=Meziantou.Framework.FullPath&version=1.0.11
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);
|Product||Versions Compatible and additional computed target framework versions.|
|.NET||net5.0 was computed. 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.|
|.NET Core||netcoreapp3.1 is compatible.|
|.NET Framework||net472 is compatible. net48 was computed. net481 was computed.|
NuGet packages (2)
Showing the top 2 NuGet packages that depend on Meziantou.Framework.FullPath:
Provide rules to validate a NuGet package follows best practices
GitHub repositories (1)
Showing the top 1 popular GitHub repositories that depend on Meziantou.Framework.FullPath:
A Roslyn analyzer to enforce some good practices in C#.