/appdirs

Package appdirs allows you to find platform-specific directories

Primary LanguageGoMIT LicenseMIT

appdirs

Go Reference CI

This is a port of the excellent python module named the same, which can be found here appdirs (now deprecated and replaced by platformdirs).

The original port was written by wessie this is a maintained fork of that project.

The Problem

When writing desktop application, finding the right location to store user data and configuration varies per platform. Even for single-platform apps, there may by plenty of nuances in figuring out the right location.

For example, if running on macOS, you should use

~/Library/Application Support/<AppName>

If on Windows (at least English Win) that should be::

C:\Documents and Settings\<User>\Application Data\Local Settings\<AppAuthor>\<AppName>

or possibly::

C:\Documents and Settings\<User>\Application Data\<AppAuthor>\<AppName>

for roaming profiles but that is another story.

On Linux (and other Unices), according to the XDG Basedir Spec, it should be

~/.local/share/<AppName>

appdirs to the rescue

This library provides a simple to use API to get the appropriate storage directories no matter the platform and what you want to store.