From fa6600a4628f0b937d0b72d7d307580c65a03209 Mon Sep 17 00:00:00 2001 From: Eric Warmenhoven Date: Sun, 7 Jan 2024 17:49:30 -0500 Subject: [PATCH] Make sure the playlist directory exists before writing a playlist --- playlist.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/playlist.c b/playlist.c index 9e3a4cc3a515..65000a6959d5 100644 --- a/playlist.c +++ b/playlist.c @@ -1676,6 +1676,7 @@ void playlist_write_file(playlist_t *playlist) size_t i, len; intfstream_t *file = NULL; bool compressed = false; + char dir_path[PATH_MAX_LENGTH]; /* Playlist will be written if any of the * following are true: @@ -1692,6 +1693,11 @@ void playlist_write_file(playlist_t *playlist) (playlist->old_format != playlist->config.old_format))) return; + fill_pathname_basedir(dir_path, playlist->config.path, sizeof(dir_path)); + if (!path_is_directory(dir_path)) + if (!path_mkdir(dir_path)) + return; + #if defined(HAVE_ZLIB) if (playlist->config.compress) file = intfstream_open_rzip_file(playlist->config.path,