tmus

TUI Music Player
git clone https://git.sinitax.com/sinitax/tmus
Log | Files | Refs | Submodules | LICENSE | sfeed.txt

commit 4efa0d0f0303be076d013c61a83b2d769778f37d
parent 4517c11fc188e2761fc7635c5379ca6b82119075
Author: Louis Burda <quent.burda@gmail.com>
Date:   Fri, 17 Feb 2023 01:09:25 +0100

fixup! Remove files if a copy is already in trash

Diffstat:
Msrc/data.c | 2++
Msrc/tui.c | 4++--
2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/data.c b/src/data.c @@ -566,6 +566,8 @@ track_move(struct track *track, struct tag *tag) struct track *new; char *newpath; + errno = 0; + newpath = aprintf("%s/%s", tag->fpath, track->name); if (path_exists(newpath)) { free(newpath); diff --git a/src/tui.c b/src/tui.c @@ -590,8 +590,8 @@ delete_current_track(void) USER_STATUS("Failed to remove track"); } else { if (!track_move(track, trash_tag) && errno != EEXIST) - USER_STATUS("Failed to trash track"); - if (!track_rm(track, true)) + USER_STATUS("Failed to trash track: %s", strerror(errno)); + if (errno == EEXIST && !track_rm(track, true)) USER_STATUS("Failed to remove track"); }