get_global_config_path

Function get_global_config_path 

Source
pub fn get_global_config_path() -> Result<PathBuf>
Expand description

Returns the path to the global AGPM configuration file.

This function constructs the path to the global configuration file following platform conventions. The global config contains user-specific settings like authentication tokens and private repository URLs.

§Returns

The path to ~/.config/agpm/config.toml, or an error if the home directory cannot be determined

§Examples

use agpm_cli::utils::fs::get_global_config_path;

let config_path = get_global_config_path()?;
println!("Global config at: {}", config_path.display());

// Check if global config exists
if config_path.exists() {
    let config = std::fs::read_to_string(&config_path)?;
    println!("Config contents: {}", config);
}

§Platform Paths

  • Linux: ~/.config/agpm/config.toml
  • macOS: ~/.config/agpm/config.toml
  • Windows: %USERPROFILE%\.config\agpm\config.toml

§Use Cases

  • Loading global user configuration
  • Storing authentication tokens securely
  • Sharing settings across multiple projects

§Security Note

This file may contain sensitive information like API tokens. It should never be committed to version control or shared publicly.