commit b2a3856a381b1e7a9e399552a9b6041aaff9ff76
parent 4043e0c796f3be54414ef903caaa95f6f08aa8e0
Author: Louis Burda <quent.burda@gmail.com>
Date: Thu, 16 Feb 2023 18:09:49 +0100
Remove files if a copy is already in trash
Diffstat:
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/tui.c b/src/tui.c
@@ -17,9 +17,10 @@
#include <ncurses.h>
+#include <unistd.h>
+#include <errno.h>
#include <ctype.h>
#include <string.h>
-#include <unistd.h>
#undef KEY_ENTER
#define KEY_ENTER '\n'
@@ -589,8 +590,10 @@ delete_current_track(void)
if (!track_rm(track, true))
USER_STATUS("Failed to remove track");
} else {
- if (!track_move(track, trash_tag))
+ if (!track_move(track, trash_tag) && errno != EEXIST)
USER_STATUS("Failed to trash track");
+ if (!track_rm(track, true))
+ USER_STATUS("Failed to remove track");
}
return true;