aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2008-01-01 10:09:23 +0000
committerEric Wong <normalperson@yhbt.net>2008-01-01 10:09:23 +0000
commit24c58132ec23d199bb7e0d9e67f5ad6af27089e8 (patch)
tree6ba8d9d9119cd29bf3a9b0c0b1fd63df5f6cc37c
parent68b9f4138140bb9c11a5f0009b23885e3f47adc5 (diff)
downloadmpd-24c58132ec23d199bb7e0d9e67f5ad6af27089e8.tar.gz
mpd-24c58132ec23d199bb7e0d9e67f5ad6af27089e8.tar.xz
mpd-24c58132ec23d199bb7e0d9e67f5ad6af27089e8.zip
playlist: cleanup pathname generation for the "rm" command, too
git-svn-id: https://svn.musicpd.org/mpd/trunk@7117 09075e82-0dd4-0310-85a5-a0d7c8717e4f
-rw-r--r--src/playlist.c20
1 files changed, 5 insertions, 15 deletions
diff --git a/src/playlist.c b/src/playlist.c
index 77e94b76b..6c2d014ce 100644
--- a/src/playlist.c
+++ b/src/playlist.c
@@ -1388,26 +1388,16 @@ int shufflePlaylist(int fd)
int deletePlaylist(int fd, char *utf8file)
{
char path_max_tmp[MPD_PATH_MAX];
- char *file = utf8_to_fs_charset(path_max_tmp, utf8file);
- char *rfile = xmalloc(strlen(file) + strlen(".") +
- strlen(PLAYLIST_FILE_SUFFIX) + 1);
- char *actualFile;
-
- strcpy(rfile, file);
- strcat(rfile, ".");
- strcat(rfile, PLAYLIST_FILE_SUFFIX);
-
- actualFile = rpp2app_r(path_max_tmp, rfile);
- if (isPlaylist(actualFile))
- free(rfile);
- else {
- free(rfile);
+
+ utf8_to_fs_playlist_path(path_max_tmp, utf8file);
+
+ if (!isPlaylist(path_max_tmp)) {
commandError(fd, ACK_ERROR_NO_EXIST,
"playlist \"%s\" not found", utf8file);
return -1;
}
- if (unlink(actualFile) < 0) {
+ if (unlink(path_max_tmp) < 0) {
commandError(fd, ACK_ERROR_SYSTEM,
"problems deleting file");
return -1;