API Reference › Os › Os.cache_dir
method

Os.cache_dir

Os.cache_dir(app) -> string

The per-user directory for an application's disposable cache — regenerable data the system may clear under disk pressure. Never store anything here you cannot recreate.

| | | | --- | --- | | macOS | ~/Library/Caches/<app> | | Linux | $XDG_CACHE_HOME/<app>, or ~/.cache/<app> |

An XDG variable that is set but empty falls back to the default, as the spec requires.

Parameters

appthe application name (used as the folder name)

Example

program CacheDir {
  entry {
    let dir = Os.cache_dir("MyGame")
    print(len(dir))
  }
}
← All symbols