[snappy] Ensure configuration dir exist before saving history



commit 41ce0c4e472f0eb7060a19d543e278aff4aead07
Author: Nicolas Dufresne <nicolas dufresne collabora com>
Date:   Fri Apr 27 11:17:09 2012 -0400

    Ensure configuration dir exist before saving history

 src/gst_engine.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/src/gst_engine.c b/src/gst_engine.c
index bc286a7..9c9e831 100644
--- a/src/gst_engine.c
+++ b/src/gst_engine.c
@@ -63,9 +63,13 @@ gboolean remove_uri_unfinished_playback (GstEngine * engine, gchar * uri);
 static void
 write_key_file_to_file (GKeyFile * keyfile, const char *path)
 {
-  gchar *data;
+  gchar *data, *dir;
   GError *error = NULL;
 
+  dir = g_path_get_dirname (path);
+  g_mkdir_with_parents (dir, S_IRUSR | S_IWUSR | S_IXUSR);
+  g_free (dir);
+
   data = g_key_file_to_data (keyfile, NULL, NULL);
   g_file_set_contents (path, data, strlen (data), &error);
   if (error != NULL) {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]