Skip to content

Commit

Permalink
resolve path in args
Browse files Browse the repository at this point in the history
  • Loading branch information
nnyyxxxx committed Nov 14, 2024
1 parent 066c070 commit abdeb7e
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
};
Expand Down

0 comments on commit abdeb7e

Please sign in to comment.