summaryrefslogtreecommitdiff
path: root/gst/gstregistrybinary.c
diff options
context:
space:
mode:
Diffstat (limited to 'gst/gstregistrybinary.c')
-rw-r--r--gst/gstregistrybinary.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/gst/gstregistrybinary.c b/gst/gstregistrybinary.c
index 53dbacfaf..75dbc3aae 100644
--- a/gst/gstregistrybinary.c
+++ b/gst/gstregistrybinary.c
@@ -134,9 +134,21 @@ gst_registry_binary_cache_finish (GstRegistry * registry,
GError *error = NULL;
if (!g_file_set_contents (cache->location, (const gchar *) cache->mem,
cache->len, &error)) {
- GST_ERROR ("Failed to write to cache file: %s", error->message);
+ /* Probably the directory didn't exist; create it */
+ gchar *dir;
+ dir = g_path_get_dirname (cache->location);
+ g_mkdir_with_parents (dir, 0777);
+ g_free (dir);
+
g_error_free (error);
- ret = FALSE;
+ error = NULL;
+
+ if (!g_file_set_contents (cache->location, (const gchar *) cache->mem,
+ cache->len, &error)) {
+ GST_ERROR ("Failed to write to cache file: %s", error->message);
+ g_error_free (error);
+ ret = FALSE;
+ }
}
g_free (cache->mem);