From 5e43f375c6c0ccb65defc55a967b54e8982f401b Mon Sep 17 00:00:00 2001 From: twinaphex Date: Mon, 15 Sep 2014 04:45:57 +0200 Subject: [PATCH] Create playlist in playlist_read_file if it doesn't already exist --- playlist.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/playlist.c b/playlist.c index b953399bca..e89dd0a1ac 100644 --- a/playlist.c +++ b/playlist.c @@ -235,6 +235,13 @@ end: return true; } +static void playlist_create_new(const char *path) +{ + FILE *file = fopen(path, "w"); + if (file) + fclose(file); +} + content_playlist_t *content_playlist_init(const char *path, size_t size) { RARCH_LOG("Opening playlist: %s.\n", path); @@ -253,6 +260,9 @@ content_playlist_t *content_playlist_init(const char *path, size_t size) playlist->cap = size; + if (!path_file_exists(path)) + playlist_create_new(path); + if (!content_playlist_read_file(playlist, path)) goto error;