Skip to content

Commit

Permalink
Make sure the playlist directory exists before writing a playlist (#1…
Browse files Browse the repository at this point in the history
  • Loading branch information
warmenhoven authored Jan 9, 2024
1 parent d7852d5 commit 8c58979
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions playlist.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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,
Expand Down

0 comments on commit 8c58979

Please sign in to comment.