gamedirs 0.0.1

Opinionated base directory helpers for Windows, Linux, and macOS (settings, saves, logs, temp). Mainly for games.
Documentation
  • Coverage
  • 25%
    4 out of 16 items documented0 out of 14 items with examples
  • Size
  • Source code size: 9.35 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 2.35 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 14s Average build duration of successful builds.
  • all releases: 14s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • piot

Gamedirs

Opinionated storage basedirs for applications, mainly for games.

Settings / Configs

Settings should be local and bound to the device.

Windows

%LOCALAPPDATA%\<company>\<app>\Config\

macOS

~/Library/Application Support/<bundle-id>/

Linux

$XDG_CONFIG_HOME/<company>/<app>/ falls back to ~/.config/<company>/<app>/

Save Games

These are things that should sync to the cloud, and be available to the user's devices.

Saves - Windows

%USERPROFILE%\Saved Games\<company>\<app>\ (use SHGetKnownFolderPath(FOLDERID_SavedGames)?)

Saves - macOS

~/Library/Application Support/<bundle-id> (some use Company/Game).

Saves - Linux

$XDG_DATA_HOME/<company>/<app>/ (fallback ~/.local/share/<company>/<app>/) (basedir-spec) [https://specifications.freedesktop.org/basedir-spec/latest/]

Logs and Debug output

Things that are inherently tied to a device, should not be synced.

Logs - Windows

%LOCALAPPDATA%\<company>\<game>\logs\ (local, non-roaming, the logs can be quite large).

Logs - macOS

~/Library/Logs/<bundle-id>/ (user logs)

Logs - Linux

Use $XDG_STATE_HOME (default ~/.local/state), e.g.: $XDG_STATE_HOME/<company>/<app>/logs/ → fallback ~/.local/state/<company>/<app>/logs/.

Temp storage (short-lived, safe to delete)

Should not be available after reboot. For temporary files that are discarded or moved to a permanent location.

Temp - Windows

GetTempPath (respects %TEMP%, %TMP%, etc.)

Temp - macOS

Use FileManager.temporaryDirectory or NSTemporaryDirectory() for per-user temp space.

Temp - Linux

Use $TMPDIR if set, otherwise /tmp

Other

bundle_id: com.companyname.appname


Copyright (c) Peter Bjorklund. All rights reserved.