FVNever.AppDirs 1.0.0

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

FVNever.AppDirs Status Enfer FVNever.AppDirs on nuget.org

A .NET library providing XDG-like base-directory resolution for application config, data, cache, and state directories in a cross-platform way.

Motivation

Many applications need to store files that outlive a single run — logs, command history, recent-files lists, window layout — but the correct place for them is different on each operating system, and encoded in platform-specific conventions that are easy to get subtly wrong. FVNever.AppDirs encapsulates these conventions so that you never assemble platform paths by hand.

Different ecosystems have different conventions on where to store different kinds of data:

This library brings access to these standards from .NET, in a portable manner (so you can find a location for any supported kind of data for every supported operating system).

Usage

using FVNever.AppDirs;

var dirs = new ApplicationDirectories("MyApp");
AbsolutePath state = dirs.StateDirectory();
// Windows: %LOCALAPPDATA%\MyApp\.state
// macOS:   throws unless a bundle identifier or compatibility mode is supplied (see below)
// Linux:   $XDG_STATE_HOME/MyApp (or ~/.local/state/MyApp)

AbsolutePath roamable = dirs.StateDirectory(roamable: true);
// Windows: %APPDATA%\MyApp\.state (the Roaming profile)
// macOS:   throws unless a bundle identifier or compatibility mode is supplied (see below)
// Linux:   $XDG_CONFIG_HOME/MyApp/.roamableState (or ~/.config/MyApp/.roamableState)

StateDirectory is a method taking an optional bool roamable = false. The default (roamable: false) resolves a machine-local, non-roaming location; roamable: true resolves a location intended to roam or sync between machines (for example the Windows Roaming profile).

You can also supply optional identity data to shape the per-OS paths:

var dirs = new ApplicationDirectories(
    "MyApp",
    vendorName: "Acme",
    macOsBundleIdentifier: "com.acme.MyApp",
    allowCompatMode: true);
AbsolutePath state = dirs.StateDirectory();
// Windows: %LOCALAPPDATA%\Acme\MyApp\.state       (vendorName is an intermediate segment)
// macOS:   ~/Library/Application Support/com.acme.MyApp/.state
  • vendorName (optional): used as an intermediate path segment on Windows, and to reconstruct the macOS bundle identifier in compatibility mode.
  • macOsBundleIdentifier (optional): used verbatim as the macOS Application Support segment.
  • allowCompatMode (optional): when no explicit macOsBundleIdentifier is given, reconstructs it as <Vendor>.<App> (or <App>); otherwise macOS resolution throws instead of guessing.

All three inputs are ignored on Linux.

Both variants of StateDirectory return a leaf directory: a location your application writes into directly. AppDirs guarantees no leaf directory contains another AppDirs-generated leaf on any OS. See the documentation site for larger examples and the full explanation of the leaf/base convention and the fail-fast behavior.

References

The per-OS mappings follow the authoritative platform conventions:

Documentation

License

The project is distributed under the terms of the MIT license.

The license indication in the project's sources is compliant with the REUSE specification v3.3.

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.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 809 8/8/2026

[Added]

- Application state folder (#2 (https://github.com/ForNeVeR/FVNever.AppDirs/issues/2)): a new ApplicationDirectories type with a StateDirectory method that resolves the per-OS application state directory as a TruePath (https://github.com/ForNeVeR/TruePath) AbsolutePath.
- non-roamable: Windows: %LOCALAPPDATA%\[<Vendor>\]<App>\.state; macOS: <Application Support>/<BundleId>/.state; Linux: $XDG_STATE_HOME/<App> or $HOME/.local/state/<App>;
- roamable: Windows: %APPDATA%\[<Vendor>\]<App>\.state (the Roaming profile); macOS: <Application Support>/<BundleId>/.roamableState; Linux: $XDG_CONFIG_HOME/<App>/.roamableState or $HOME/.config/<App>/.roamableState.