summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLouis Burda <quent.burda@gmail.com>2023-02-17 01:09:25 +0100
committerLouis Burda <quent.burda@gmail.com>2023-02-17 01:11:40 +0100
commit4efa0d0f0303be076d013c61a83b2d769778f37d (patch)
tree071086c4842c1ea341572b9ee1e89ea8d18e9a19 /src
parent4517c11fc188e2761fc7635c5379ca6b82119075 (diff)
downloadtmus-4efa0d0f0303be076d013c61a83b2d769778f37d.tar.gz
tmus-4efa0d0f0303be076d013c61a83b2d769778f37d.zip
fixup! Remove files if a copy is already in trash
Diffstat (limited to 'src')
-rw-r--r--src/data.c2
-rw-r--r--src/tui.c4
2 files changed, 4 insertions, 2 deletions
diff --git a/src/data.c b/src/data.c
index 1ba1147..31fe05a 100644
--- 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
index b3af7f2..36d0c14 100644
--- 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");
}