Skip to main content

get_app_dir

Function get_app_dir 

Source
pub fn get_app_dir(app_name: &str, _roaming: bool) -> PathBuf
Expand description

Get the platform-specific application directory.

Returns the appropriate directory for storing application data based on the platform:

  • Unix: ~/.app_name (non-roaming) or ~/.local/share/app_name (roaming)
  • macOS: ~/Library/Application Support/app_name
  • Windows: %APPDATA%\app_name (roaming) or %LOCALAPPDATA%\app_name (non-roaming)

§Arguments

  • app_name - The name of the application
  • roaming - Whether to use the roaming profile (Windows) or XDG data dir (Unix)

§Example

use click::utils::get_app_dir;

let app_dir = get_app_dir("myapp", false);
println!("App directory: {}", app_dir.display());