Skip to content

Commit

Permalink
config: deprecate yofi.config
Browse files Browse the repository at this point in the history
Prints a warning if yofi.config is loaded, please migrate your
configurations by renaming yofi.config -> yofi.toml.
  • Loading branch information
jdek committed May 27, 2024
1 parent ccce517 commit 35cbd2c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

## Changes

- yofi.config is deprecated.

## Fixes

# 0.2.2 - 2024-03-10
Expand Down
5 changes: 4 additions & 1 deletion src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,15 @@ fn default_config_path() -> Result<Option<PathBuf>> {
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));
}
}
Expand Down

0 comments on commit 35cbd2c

Please sign in to comment.