From 35cbd2c4772a91fdd14e5e49a4a4bd63ad6593cc Mon Sep 17 00:00:00 2001 From: "J. Dekker" Date: Mon, 27 May 2024 03:55:56 +0200 Subject: [PATCH] config: deprecate yofi.config Prints a warning if yofi.config is loaded, please migrate your configurations by renaming yofi.config -> yofi.toml. --- CHANGELOG.md | 2 ++ src/config.rs | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6313324..bd76c07 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ ## Changes +- yofi.config is deprecated. + ## Fixes # 0.2.2 - 2024-03-10 diff --git a/src/config.rs b/src/config.rs index 449650a..2f10962 100644 --- a/src/config.rs +++ b/src/config.rs @@ -118,12 +118,15 @@ fn default_config_path() -> Result> { let xdg_dirs = xdg::BaseDirectories::with_prefix(crate::prog_name!()).context("failed to get xdg dirs")?; - for &filename in &DEFAULT_CONFIG_NAMES { + for (index, &filename) in DEFAULT_CONFIG_NAMES.iter().enumerate() { let file = xdg_dirs.get_config_file(filename); if file .try_exists() .with_context(|| format!("reading default config at {}", file.display()))? { + if index != 0 { + eprintln!("warning: yofi.config is deprecated, please rename your configuration file to yofi.toml"); + } return Ok(Some(file)); } }