File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed
Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -260,25 +260,29 @@ All the contents from the trash more then {days} days will be deleted permanentl
260260 continue ;
261261 }
262262
263- if ignore {
264- // not need of seperate function for this
265- if path. is_dir ( ) {
263+ match ( ignore, path. is_dir ( ) , path. is_file ( ) ) {
264+ ( true , true , _) => {
266265 if let Err ( e) = fs:: remove_dir_all ( & path) {
267266 eprintln ! (
268267 "{}" ,
269268 format!( "Error deleting with out moving to trash: {e}" ) . red( )
270269 )
271270 }
272- } else if path. is_file ( ) {
271+ }
272+ ( true , false , true ) => {
273273 if let Err ( e) = fs:: remove_file ( & path) {
274274 eprintln ! (
275275 "{}" ,
276276 format!( "Error deleting with out moving to trash: {e}" ) . red( )
277277 )
278278 }
279279 }
280- } else if let Err ( e) = delete ( & path) {
281- eprintln ! ( "{}" , format!( "Error moving to trash: {e}" ) . red( ) ) ;
280+ ( false , _, _) => {
281+ if let Err ( e) = delete ( & path) {
282+ eprintln ! ( "{}" , format!( "Error moving to trash: {e}" ) . red( ) ) ;
283+ }
284+ }
285+ _ => { }
282286 }
283287 }
284288 }
You can’t perform that action at this time.
0 commit comments