Skip to content

Commit a603ee3

Browse files
authored
fix: bug of -i flag
Now we can remove file as well as Dir permanently with -i flag
1 parent f7da935 commit a603ee3

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

src/main.rs

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -262,11 +262,20 @@ All the contents from the trash more then {days} days will be deleted permanentl
262262

263263
if ignore {
264264
// not need of seperate function for this
265-
if let Err(e) = fs::remove_dir_all(&path) {
266-
eprintln!(
267-
"{}",
268-
format!("Error deleting with out moving to trash: {e}").red()
269-
)
265+
if path.is_dir() {
266+
if let Err(e) = fs::remove_dir_all(&path) {
267+
eprintln!(
268+
"{}",
269+
format!("Error deleting with out moving to trash: {e}").red()
270+
)
271+
}
272+
} else if path.is_file() {
273+
if let Err(e) = fs::remove_file(&path) {
274+
eprintln!(
275+
"{}",
276+
format!("Error deleting with out moving to trash: {e}").red()
277+
)
278+
}
270279
}
271280
} else if let Err(e) = delete(&path) {
272281
eprintln!("{}", format!("Error moving to trash: {e}").red());

0 commit comments

Comments
 (0)