Skip to content

Commit 606a592

Browse files
committed
handled the home dir err
1 parent 6fd5268 commit 606a592

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/main.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@ fn main() {
1515
let dir = args.dir;
1616

1717
// getting the home directory and appending .trash to it
18-
let trash = home_dir().unwrap().join(".trash/");
18+
let trash = match home_dir() {
19+
Some(dir) => dir.join(".trash/"),
20+
None => panic!("Could not find home directory"),
21+
};
1922

2023
// tidying the trash directory if the flag is set
2124
if tidy {

0 commit comments

Comments
 (0)