A .NET Standard library for the XDG Base Directory Specification and XDG user directories.
Xdg.Directories is a small (the .dll is only 11 KB), fast and portable (Completely supports .NET Standard 2.0 and even NativeAOT!) .NET implementation of the XDG Base Directory Specification and XDG user directories for Windows, MacOS and Linux/FreeBSD.
Full documentation can be found at https://xdg-net.github.io/Xdg.Directories.
Use NuGet to install Xdg.Directories.
From the .NET CLI:
dotnet add package Xdg.Directories
or from Visual Studio's package manager:
Install-Package Xdg.Directories
Preview releases are uploaded to both GitHub packages (need GitHub account to download) and Forgejo packages (no login required).
using System;
using Xdg.Directories;
// Prints /home/$USER/.local/share
Console.Writeline(BaseDirectory.DataHome);
// Prints /home/$USER/.cache
Console.Writeline(BaseDirectory.CacheHome)
open Xdg.Directories
// Prints /home/$USER/Documents
printfn "%s" UserDirectory.DesktopDir
This project is licensed under the MIT license.
Icon is made by Emoji One, CC BY-SA 4.0, via Wikimedia Commons an image.