1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
|
From: sfan5 <sfan5@live.de>
Date: Sun, 1 Jun 2025 17:36:44 +0200
Subject: player: create missing folders for watch-history-path
fixes: #16357
---
player/loadfile.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/player/loadfile.c b/player/loadfile.c
index b6b71fd..96c0fc4 100644
--- a/player/loadfile.c
+++ b/player/loadfile.c
@@ -1546,8 +1546,12 @@ static void append_to_watch_history(struct MPContext *mpctx)
void *ctx = talloc_new(NULL);
char *history_path = mp_get_user_path(ctx, mpctx->global,
mpctx->opts->watch_history_path);
- FILE *history_file = fopen(history_path, "ab");
+ char *history_path_dir = bstrto0(ctx, mp_dirname(history_path));
+ if (!mp_path_exists(history_path_dir)) {
+ mp_mkdirp(history_path_dir);
+ }
+ FILE *history_file = fopen(history_path, "ab");
if (!history_file) {
MP_ERR(mpctx, "Failed to open history file: %s\n",
mp_strerror(errno));
|