AppDirs

1.4.4 · deprecated · verified Sat Mar 28

AppDirs is a small Python module (version 1.4.4) designed to determine appropriate platform-specific directories for storing user data, configuration, cache, and log files across Linux, macOS, and Windows. This project has been officially deprecated, and `platformdirs` is recommended as a more actively maintained alternative.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to use `appdirs` to retrieve common application-specific directory paths for the current user and platform. It also shows how to create one of these directories if it doesn't already exist.

from appdirs import user_data_dir, user_cache_dir, user_log_dir
import os

appname = "MyApplication"
appauthor = "MyCompany"
appversion = "1.0.0"

# Get platform-specific directories
data_dir = user_data_dir(appname, appauthor, appversion=appversion)
cache_dir = user_cache_dir(appname, appauthor)
log_dir = user_log_dir(appname, appauthor)

print(f"Data directory: {data_dir}")
print(f"Cache directory: {cache_dir}")
print(f"Log directory: {log_dir}")

# Example: Ensure the data directory exists
os.makedirs(data_dir, exist_ok=True)
print(f"Ensured data directory exists: {os.path.exists(data_dir)}")

view raw JSON →