Skip to main content

Module dirs

Module dirs 

Source
Expand description

Where an application keeps its settings: the user’s configuration folder, as each platform names it.

Configuration
Linux and BSD$XDG_CONFIG_HOME/<app> (~/.config/<app>)
macOS~/Library/Application Support/<app>
Windows%APPDATA%\<app>

AppBuilder::persist_in_config saves the settings, the layout and the window’s place there. Inside a Flatpak sandbox, XDG_CONFIG_HOME points into the application’s own directory, so the same code finds the sandbox’s place. The state, the logs and the caches are elsewhere (egui_pop_platform::dirs).

let dir = egui_pop_api::dirs::config_dir_with("demo", |name| match name {
    "XDG_CONFIG_HOME" => Some("/config".into()),
    _ => None,
});
if cfg!(all(unix, not(target_os = "macos"))) {
    assert_eq!(dir, Some("/config/demo".into()));
}

Functions§

config_dir
The application’s configuration folder (see the module).
config_dir_with
The application’s configuration folder, from the environment env gives (None: the variables it needs are missing, or on the web).