From abdeb7e05da9ee8a12bf4444937f3a8e2d30768b Mon Sep 17 00:00:00 2001 From: nnyyxxxx Date: Wed, 13 Nov 2024 22:40:56 -0500 Subject: [PATCH] resolve path in args --- src/main.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/main.rs b/src/main.rs index 82fec1f..bce3276 100644 --- a/src/main.rs +++ b/src/main.rs @@ -66,9 +66,27 @@ fn main() { let cli = Cli { wallpaper: cli .wallpaper + .map(|p| { + if p.is_relative() { + std::env::current_dir() + .map(|cur| cur.join(p.clone())) + .unwrap_or(p) + } else { + p + } + }) .map(|p| PathBuf::from(shellexpand::tilde(&p.to_string_lossy()).into_owned())), folder: cli .folder + .map(|p| { + if p.is_relative() { + std::env::current_dir() + .map(|cur| cur.join(p.clone())) + .unwrap_or(p) + } else { + p + } + }) .map(|p| PathBuf::from(shellexpand::tilde(&p.to_string_lossy()).into_owned())), ..cli };