summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Smith <msmith@xiph.org>2008-11-20 20:44:56 +0000
committerMichael Smith <msmith@xiph.org>2008-11-20 20:44:56 +0000
commit8b1ed490b3587efa4bb3a3eb6717c92bd1c95ec6 (patch)
tree777e277b48fb2a64188628fb9e60815b0066d82e
parent94752eaefd786a16baad22225e5dc93acab74d47 (diff)
gst/gstregistrybinary.c: In win32 codepath, if we fail to write the registry, create the directory for it and try aga...
Original commit message from CVS: * gst/gstregistrybinary.c: In win32 codepath, if we fail to write the registry, create the directory for it and try again, matching the behaviour in non-win32 codepaths.
-rw-r--r--ChangeLog7
-rw-r--r--gst/gstregistrybinary.c16
2 files changed, 21 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index dff49668c..91bec7c95 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2008-11-20 Michael Smith <msmith@songbirdnest.com>
+
+ * gst/gstregistrybinary.c:
+ In win32 codepath, if we fail to write the registry, create the
+ directory for it and try again, matching the behaviour in non-win32
+ codepaths.
+
2008-11-20 Wim Taymans <wim.taymans@collabora.co.uk>
* libs/gst/base/gstbasesink.c: (gst_base_sink_set_render_delay):
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);