Skip to content

Instantly share code, notes, and snippets.

@rogeruiz
Forked from roalcantara/XDG.cheat-sheet.md
Created February 24, 2024 00:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rogeruiz/ff90341955dc85c87d5eeaa4bdab292b to your computer and use it in GitHub Desktop.
Save rogeruiz/ff90341955dc85c87d5eeaa4bdab292b to your computer and use it in GitHub Desktop.
XDG cheat sheet

XDG - Base Directory Specification

Directories

Base

The intended use-case for BaseDirectories is to query the paths of user-invisible standard directories that have been defined according to the conventions of the operating system the library is running on.

If you want to compute the location of cache, config or data folders for your own application or project, use ProjectDirectories instead.

User

The intended use-case for UserDirectories is to query the paths of user-facing standard directories that have been defined according to the conventions of the operating system the library is running on.

Project

The intended use-case for ProjectDirectories is to compute the location of cache, config or data folders for your own application or project, which are derived from the standard directories.

Correlations

Type Purpose XDG Environment Variable Linux / BSD MacOS
Base home HOME $HOME $HOME
Base cache XDG_CACHE_HOME $XDG_CACHE_HOME or $HOME/.cache $HOME/Library/Caches
Base config XDG_CONFIG_HOME $XDG_CONFIG_HOME or $HOME/.config $HOME/Library/Application Support
Base data XDG_DATA_HOME $XDG_DATA_HOME or $HOME/.local/share $HOME/Library/Application Support
Base dataLocal XDG_DATA_HOME $XDG_DATA_HOME or $HOME/.local/share $HOME/Library/Application Support
Base executable XDG_BIN_HOME $XDG_BIN_HOME or $HOME/.local/bin null
Base preference XDG_CONFIG_HOME $XDG_CONFIG_HOME or $HOME/.config $HOME/Library/Preferences
Base runtime XDG_RUNTIME_DIR $XDG_RUNTIME_DIR or null null
User audio XDG_MUSIC_DIR $XDG_MUSIC_DIR $HOME/Music
User desktop XDG_DESKTOP_DIR $XDG_DESKTOP_DIR $HOME/Desktop
User document XDG_DOCUMENTS_DIR $XDG_DOCUMENTS_DIR $HOME/Documents
User download XDG_DOWNLOAD_DIR $XDG_DOWNLOAD_DIR $HOME/Downloads
User font XDG_DATA_HOME $XDG_DATA_HOME/fonts or $HOME/.local/share/fonts $HOME/Library/Fonts
User picture XDG_PICTURES_DIR $XDG_PICTURES_DIR $HOME/Pictures
User public XDG_PUBLICSHARE_DIR $XDG_PUBLICSHARE_DIR $HOME/Public
User template XDG_TEMPLATES_DIR $XDG_TEMPLATES_DIR null
User video XDG_VIDEOS_DIR $XDG_VIDEOS_DIR $HOME/Movies
Project cache XDG_CACHE_HOME/<project_path> $XDG_CACHE_HOME or $HOME/.cache/<project_path> $HOME/Library/Caches/<project_path>
Project config XDG_CONFIG_HOME/<project_path> $XDG_CONFIG_HOME or $HOME/.config/<project_path> $HOME/Library/Preferences/<project_path>
Project data XDG_CONFIG_HOME/<project_path> $XDG_CONFIG_HOME or $HOME/.config/<project_path> $HOME/Library/Application Support/<project_path>
Project dataLocal XDG_DATA_HOME/<project_path> $XDG_DATA_HOME or $HOME/.local/share/<project_path> $HOME/Library/Application Support/<project_path>
Project preference XDG_DATA_HOME/<project_path> $XDG_DATA_HOME or $HOME/.local/share/<project_path> $HOME/Library/Application Support/<project_path>
Project runtime XDG_RUNTIME_DIR/<project_path> $XDG_RUNTIME_DIR/<project_path> null

source: https://github.com/dirs-dev/directories-jvm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment