MCPcopy Create free account
hub / github.com/CodSpeedHQ/codspeed / get_configuration_file_path

Function get_configuration_file_path

src/config.rs:128–141  ·  view source on GitHub ↗

Get the path to the configuration file, following the XDG Base Directory Specification at https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html If config_name is None, returns ~/.config/codspeed/config.yaml (default) If config_name is Some, returns ~/.config/codspeed/{config_name}.yaml

(config_name: Option<&str>)

Source from the content-addressed store, hash-verified

126/// If config_name is None, returns ~/.config/codspeed/config.yaml (default)
127/// If config_name is Some, returns ~/.config/codspeed/{config_name}.yaml
128fn get_configuration_file_path(config_name: Option<&str>) -> PathBuf {
129 let config_dir = env::var("XDG_CONFIG_HOME")
130 .map(PathBuf::from)
131 .unwrap_or_else(|_| {
132 let home = env::var("HOME").expect("HOME env variable not set");
133 PathBuf::from(home).join(".config")
134 });
135 let config_dir = config_dir.join("codspeed");
136
137 match config_name {
138 Some(name) => config_dir.join(format!("{name}.yaml")),
139 None => config_dir.join("config.yaml"),
140 }
141}
142
143impl CodSpeedConfig {
144 /// Wrap a [`PersistedConfig`] with placeholder runtime values. The

Callers 2

write_persistedFunction · 0.85
load_with_profileMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected