API Reference › Os › Os.config_dir
method

Os.config_dir

Os.config_dir(app) -> string

The per-user directory where an application should store configuration, named for the app.

| | | | --- | --- | | macOS | ~/Library/Application Support/<app> | | Linux | $XDG_CONFIG_HOME/<app>, or ~/.config/<app> |

On macOS this is the same directory as save_dir — the platform keeps config and saves together, and Apple's home for a config file that is not an NSUserDefaults plist is Application Support. On Linux XDG separates the two. 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 ConfigDir {
  entry {
    let dir = Os.config_dir("MyGame")
    print(len(dir))
  }
}
← All symbols