stored_playlist: renamed and moved spl_delete() to stored_playlist.c
The function deletePlaylist() shouldn't be in playlist.c.
This commit is contained in:
parent
39f0c41fbf
commit
93598e28f4
@ -626,7 +626,7 @@ handle_rm(struct client *client, mpd_unused int argc, char *argv[])
|
||||
{
|
||||
enum playlist_result result;
|
||||
|
||||
result = deletePlaylist(argv[1]);
|
||||
result = spl_delete(argv[1]);
|
||||
return print_playlist_result(client, result);
|
||||
}
|
||||
|
||||
|
@ -1185,20 +1185,6 @@ void shufflePlaylist(void)
|
||||
}
|
||||
}
|
||||
|
||||
enum playlist_result deletePlaylist(const char *utf8file)
|
||||
{
|
||||
char path_max_tmp[MPD_PATH_MAX];
|
||||
|
||||
utf8_to_fs_playlist_path(path_max_tmp, utf8file);
|
||||
|
||||
if (unlink(path_max_tmp) < 0)
|
||||
return errno == ENOENT
|
||||
? PLAYLIST_RESULT_NO_SUCH_LIST
|
||||
: PLAYLIST_RESULT_ERRNO;
|
||||
|
||||
return PLAYLIST_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
enum playlist_result savePlaylist(const char *utf8file)
|
||||
{
|
||||
FILE *fp;
|
||||
|
@ -109,8 +109,6 @@ void shufflePlaylist(void);
|
||||
|
||||
enum playlist_result savePlaylist(const char *utf8file);
|
||||
|
||||
enum playlist_result deletePlaylist(const char *utf8file);
|
||||
|
||||
void
|
||||
deleteASongFromPlaylist(const struct song *song);
|
||||
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -53,6 +53,9 @@ spl_move_index(const char *utf8path, unsigned src, unsigned dest);
|
||||
enum playlist_result
|
||||
spl_clear(const char *utf8path);
|
||||
|
||||
enum playlist_result
|
||||
spl_delete(const char *name_utf8);
|
||||
|
||||
enum playlist_result
|
||||
spl_remove_index(const char *utf8path, unsigned pos);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user