From ff410167c7d987b43608b6d95e20a745cc807f41 Mon Sep 17 00:00:00 2001 From: aidanaden Date: Fri, 21 Jun 2024 01:42:48 +0800 Subject: [PATCH] feat: display config file path in error --- rm-config/src/lib.rs | 2 +- rm-main/src/app.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/rm-config/src/lib.rs b/rm-config/src/lib.rs index 9fddaec..8de59d7 100644 --- a/rm-config/src/lib.rs +++ b/rm-config/src/lib.rs @@ -113,7 +113,7 @@ impl Config { XDG_DIRS.get_or_init(|| xdg::BaseDirectories::with_prefix("rustmission").unwrap()) } - fn get_config_path() -> &'static PathBuf { + pub fn get_config_path() -> &'static PathBuf { CONFIG_PATH.get_or_init(|| { Self::get_xdg_dirs() .place_config_file("config.toml") diff --git a/rm-main/src/app.rs b/rm-main/src/app.rs index c0d34cd..89f8620 100644 --- a/rm-main/src/app.rs +++ b/rm-main/src/app.rs @@ -44,9 +44,9 @@ impl Ctx { }); } Err(e) => { - let url = config.connection.url; + let config_path = Config::get_config_path().to_str().unwrap(); return Err(Error::msg(format!( - "{e}\nIs the connection info in {url} correct?" + "{e}\nIs the connection info in {config_path} correct?" ))); } }