From e5a1264df1fc429899a5d651761df9a72f49c6c9 Mon Sep 17 00:00:00 2001 From: Ron Waldon-Howe Date: Sun, 17 Nov 2024 21:46:21 +1100 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20`Config::servicedir=20->?= =?UTF-8?q?=20`Config::servicedirs`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This value is a `Vec` so the plural seems more appropriate and consistent --- src/config.rs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/config.rs b/src/config.rs index 00ae0a9..f8415c0 100644 --- a/src/config.rs +++ b/src/config.rs @@ -64,7 +64,7 @@ pub struct Config { /// which tell the dbus-daemon how to start a program to provide a particular well-known bus /// name. #[serde(default)] - pub servicedir: Vec, + pub servicedirs: Vec, /// Specifies the setuid helper that is used to launch system daemons with an alternate user. pub servicehelper: Option, @@ -115,7 +115,7 @@ impl TryFrom for Config { } } Element::Servicedir(p) => { - bc.servicedir.push(p); + bc.servicedirs.push(p); } Element::Servicehelper(p) => { // NOTE: we're assuming this has the same "last one wins" behaviour as `` @@ -128,10 +128,10 @@ impl TryFrom for Config { // TODO: warn and then ignore if we aren't reading: /etc/dbus-1/session.conf if let Some(base) = BaseDirs::new() { if let Some(runtime_dir) = base.runtime_dir() { - bc.servicedir + bc.servicedirs .push(runtime_dir.join("dbus-1/services").to_path_buf()); } - bc.servicedir + bc.servicedirs .push(base.data_dir().join("dbus-1/services").to_path_buf()); } let mut servicedirs_in_data_dirs = xdg_data_dirs() @@ -139,8 +139,8 @@ impl TryFrom for Config { .map(|p| p.join("dbus-1/services")) .map(PathBuf::from) .collect(); - bc.servicedir.append(&mut servicedirs_in_data_dirs); - bc.servicedir + bc.servicedirs.append(&mut servicedirs_in_data_dirs); + bc.servicedirs .push(PathBuf::from("/usr/share/dbus-1/services")); // TODO: add Windows-specific session directories } @@ -148,7 +148,7 @@ impl TryFrom for Config { // NOTE: because servicedir sequence is important, we cannot de-duplicate this // TODO: warn and then ignore if we aren't reading: // /usr/share/dbus-1/system.conf - bc.servicedir + bc.servicedirs .extend(STANDARD_SYSTEM_SERVICEDIRS.iter().map(PathBuf::from)); } Element::Syslog => bc.syslog = true, @@ -1114,11 +1114,11 @@ mod tests { // TODO: improve test: contents are dynamic depending upon environment variables assert_eq!( - busconfig.servicedir.first(), + busconfig.servicedirs.first(), Some(&PathBuf::from("/example")) ); assert_eq!( - busconfig.servicedir.last(), + busconfig.servicedirs.last(), Some(&PathBuf::from("/usr/share/dbus-1/services")) ); } @@ -1140,7 +1140,7 @@ mod tests { assert_eq!( busconfig, Config { - servicedir: vec![ + servicedirs: vec![ PathBuf::from("/example"), PathBuf::from("/usr/local/share/dbus-1/system-services"), PathBuf::from("/usr/share/dbus-1/system-services"),