Skip to content

Feature request: API to get paths for cache folder and preferences folder #13986

@impiaaa

Description

@impiaaa

Currently, SDL has SDL_GetPrefPath to get the path of a general-purpose writable directory, that returns:

  • %APPDATA%\Roaming\CompanyName\AppName on Windows
  • ~/Library/Application Support/AppName on macOS
  • ~/.local/share/AppName on Linux/XDG
  • /data/data/AppName/files on Android

It would also be handy to get more specific paths, like for storing cache data:

  • %APPDATA%\Local\CompanyName\AppName on Windows (I think so anyway, I'm not experienced here)
  • ~/Library/Cache/AppName on macOS
  • ~/.cache/AppName on Linux/XDG
  • /data/data/AppName/cache on Android (exposed through SDL_GetAndroidCachePath in SDL)

or preferences or configuration data:

  • ~/Library/Preferences/AppName on macOS
  • ~/.config/AppName on Linux/XDG
  • (I think there is none on Windows because you're expected to use the registry for that)

SDL also has SDL_GetUserFolder that these could be added to, but SDL_GetUserFolder is currently just for user-visible folders like Documents and Downloads, whereas the cache and prefs are hidden by default in the OSs listed above. A new API for this could help fix #4447 and make #3336 more explicit/transparent.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions