Skip to main content

default_settings_path

Function default_settings_path 

Source
pub fn default_settings_path(app_name: &str) -> PathBuf
Expand description

Get the default settings file path for the current platform.

  • Windows: %LOCALAPPDATA%\<app_name>\settings.json
  • macOS: ~/Library/Application Support/<app_name>/settings.json
  • Linux: $XDG_DATA_HOME/<app_name>/settings.json or ~/.local/share/<app_name>/settings.json
  • iOS: <HOME>/Documents/<app_name>/settings.json
  • Android: /data/data/<app_name>/files/settings.json

Android note: This uses the hard-coded path /data/data/<app_name>/files/. In a real Android application, obtain the data directory from the Android context at runtime (e.g. via JNI) using context.getFilesDir() instead.