Make sure the playlist directory exists before writing a playlist (#16085)

This commit is contained in:
Eric Warmenhoven 2024-01-09 03:18:23 -05:00 committed by GitHub
parent d7852d5db9
commit 8c58979d76
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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,