Platform details

platformdirs auto-detects the current platform and returns the correct directory paths. This page describes the default paths for each platform and any platform-specific behavior.

All examples below assume appname="SuperApp" and appauthor="Acme" unless stated otherwise.

User directories

These are user-specific (and, generally, user-writeable) directories.

user_data_dir

See also: User data directory

~/.local/share/SuperApp

~/Library/Application Support/SuperApp

C:\Users\<User>\AppData\Local\Acme\SuperApp

/data/data/<pkg>/files/SuperApp

user_config_dir

See also: User config directory

~/.config/SuperApp

~/Library/Application Support/SuperApp

C:\Users\<User>\AppData\Local\Acme\SuperApp

/data/data/<pkg>/shared_prefs/SuperApp

user_cache_dir

See also: User cache directory

~/.cache/SuperApp

~/Library/Caches/SuperApp

C:\Users\<User>\AppData\Local\Acme\SuperApp\Cache

/data/data/<pkg>/cache/SuperApp

user_state_dir

See also: User state directory

~/.local/state/SuperApp

~/Library/Application Support/SuperApp

C:\Users\<User>\AppData\Local\Acme\SuperApp

/data/data/<pkg>/files/SuperApp

user_log_dir

See also: User log directory

~/.local/state/SuperApp/log

~/Library/Logs/SuperApp

C:\Users\<User>\AppData\Local\Acme\SuperApp\Logs

/data/data/<pkg>/cache/SuperApp/log

user_runtime_dir

See also: User runtime directory

/run/user/<uid>/SuperApp

~/Library/Caches/TemporaryItems/SuperApp

C:\Users\<User>\AppData\Local\Temp\Acme\SuperApp

/data/data/<pkg>/cache/SuperApp/tmp

user_applications_dir

See also: User applications directory

~/.local/share/applications

~/Applications

C:\Users\<User>\AppData\Roaming\Microsoft\Windows\Start Menu\Programs

Same as user_data_dir

Note

This property does not append appname or version. It returns the shared applications directory where .desktop files (Linux), app bundles (macOS), or Start Menu shortcuts (Windows) are placed.

user_bin_dir

See also: User binary directory

~/.local/bin

~/.local/bin

C:\Users\<User>\AppData\Local\Programs

/data/data/<pkg>/files/bin

Note

This property does not append appname or version. It returns the directory where user-installed executables and scripts are placed.

user_documents_dir

See also: User documents directory

~/Documents

~/Documents

C:\Users\<User>\Documents

/storage/emulated/0/Documents

user_downloads_dir

See also: User downloads directory

~/Downloads

~/Downloads

C:\Users\<User>\Downloads

/storage/emulated/0/Downloads

user_pictures_dir

See also: User pictures directory

~/Pictures

~/Pictures

C:\Users\<User>\Pictures

/storage/emulated/0/Pictures

user_videos_dir

See also: User videos directory

~/Videos

~/Movies

C:\Users\<User>\Videos

/storage/emulated/0/DCIM/Camera

user_music_dir

See also: User music directory

~/Music

~/Music

C:\Users\<User>\Music

/storage/emulated/0/Music

user_desktop_dir

See also: User desktop directory

~/Desktop

~/Desktop

C:\Users\<User>\Desktop

/storage/emulated/0/Desktop

user_projects_dir

See also: User projects directory

Defined by $XDG_PROJECTS_DIR (recently added to xdg-user-dirs).

~/Projects (from $XDG_PROJECTS_DIR if set, else $XDG_PROJECTS_DIR entry in user-dirs.dirs, else ~/Projects)

~/Projects

C:\Users\<User>\Projects

/storage/emulated/0/Projects

user_publicshare_dir

See also: User public share directory

Defined by $XDG_PUBLICSHARE_DIR.

On Windows, this is the machine-wide C:\Users\Public (%PUBLIC%), shared across all local accounts — not a per-user directory. See FOLDERID_Public.

~/Public (from $XDG_PUBLICSHARE_DIR if set, else $XDG_PUBLICSHARE_DIR entry in user-dirs.dirs, else ~/Public)

~/Public

C:\Users\Public (%PUBLIC%)

/storage/emulated/0/Public

user_templates_dir

See also: User templates directory

Defined by $XDG_TEMPLATES_DIR. macOS has no platform-defined templates directory; ~/Templates is returned as a pragmatic fallback. On Windows, see FOLDERID_Templates.

~/Templates (from $XDG_TEMPLATES_DIR if set, else $XDG_TEMPLATES_DIR entry in user-dirs.dirs, else ~/Templates)

~/Templates (pragmatic fallback; macOS has no native templates directory)

%APPDATA%\Microsoft\Windows\Templates

/storage/emulated/0/Templates

user_fonts_dir

See also: User fonts directory

Derived from $XDG_DATA_HOME/fonts on Linux (no dedicated env var). See the XDG Base Directory Specification. On Windows, uses the per-user font location added in Windows 10.

$XDG_DATA_HOME/fonts (default ~/.local/share/fonts)

~/Library/Fonts

%LOCALAPPDATA%\Microsoft\Windows\Fonts

/storage/emulated/0/fonts

user_preference_dir

See also: User preference directory

On macOS, ~/Library/Preferences is distinct from ~/Library/Application Support (user_config_dir). See Apple’s File System Programming Guide. On all other platforms, this aliases user_config_dir.

Same as user_config_dir ($XDG_CONFIG_HOME or ~/.config/AppName)

~/Library/Preferences/AppName (distinct from ~/Library/Application Support)

Same as user_config_dir (%APPDATA%\AppName)

Same as user_config_dir

Shared directories

These are system-wide (and, generally, read-only) directories.

site_data_dir

See also: Shared data directory

/usr/local/share/SuperApp

/Library/Application Support/SuperApp

C:\ProgramData\Acme\SuperApp

/data/data/<pkg>/files/SuperApp

site_config_dir

See also: Shared config directory

/etc/xdg/SuperApp

/Library/Application Support/SuperApp

C:\ProgramData\Acme\SuperApp

/data/data/<pkg>/shared_prefs/SuperApp

site_cache_dir

See also: Shared cache directory

/var/cache/SuperApp

/Library/Caches/SuperApp

C:\ProgramData\Acme\SuperApp\Cache

/data/data/<pkg>/cache/SuperApp

site_state_dir

See also: Shared state directory

/var/lib/SuperApp

/Library/Application Support/SuperApp

C:\ProgramData\Acme\SuperApp

/data/data/<pkg>/files/SuperApp

site_log_dir

See also: Shared log directory

/var/log/SuperApp

/Library/Logs/SuperApp

C:\ProgramData\Acme\SuperApp\Logs

/data/data/<pkg>/cache/SuperApp/log

site_runtime_dir

See also: Shared runtime directory

/run/SuperApp

~/Library/Caches/TemporaryItems/SuperApp

C:\Users\<User>\AppData\Local\Temp\Acme\SuperApp

/data/data/<pkg>/cache/SuperApp/tmp

site_applications_dir

See also: Shared applications directory

/usr/share/applications

/Applications

C:\ProgramData\Microsoft\Windows\Start Menu\Programs

Same as user_applications_dir

Note

This property does not append appname or version. It returns the system-wide applications directory where .desktop files (Linux), app bundles (macOS), or Start Menu shortcuts (Windows) are installed for all users.

site_bin_dir

See also: Shared binary directory

/usr/local/bin

/usr/local/bin

C:\ProgramData\bin

Same as user_bin_dir

Note

This property does not append appname or version. It returns the directory where system-wide executables and scripts are placed. On Unix/Linux, this follows the FHS 3.0 standard for locally installed software. On Windows, it mirrors the site_data_dir pattern using %ProgramData%, following the precedent set by Chocolatey.

See also

For platform-specific conventions and behavior details, see Understanding platformdirs.