From 93598e28f48a6a2da332287a3b8c0966a99e66d9 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 23 Oct 2008 09:54:32 +0200 Subject: stored_playlist: renamed and moved spl_delete() to stored_playlist.c The function deletePlaylist() shouldn't be in playlist.c. --- src/stored_playlist.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/stored_playlist.c') diff --git a/src/stored_playlist.c b/src/stored_playlist.c index cb81962d1..61d4d8cc3 100644 --- a/src/stored_playlist.c +++ b/src/stored_playlist.c @@ -265,6 +265,21 @@ spl_clear(const char *utf8path) return PLAYLIST_RESULT_SUCCESS; } +enum playlist_result +spl_delete(const char *name_utf8) +{ + char filename[MPD_PATH_MAX]; + + utf8_to_fs_playlist_path(filename, name_utf8); + + if (unlink(filename) < 0) + return errno == ENOENT + ? PLAYLIST_RESULT_NO_SUCH_LIST + : PLAYLIST_RESULT_ERRNO; + + return PLAYLIST_RESULT_SUCCESS; +} + enum playlist_result spl_remove_index(const char *utf8path, unsigned pos) { -- cgit v1.2.3