From 24c58132ec23d199bb7e0d9e67f5ad6af27089e8 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Tue, 1 Jan 2008 10:09:23 +0000 Subject: playlist: cleanup pathname generation for the "rm" command, too git-svn-id: https://svn.musicpd.org/mpd/trunk@7117 09075e82-0dd4-0310-85a5-a0d7c8717e4f --- src/playlist.c | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) (limited to 'src') 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; -- cgit v1.2.3