[gnome-builder] libide: ensure drafts dir exists



commit 2a61d0d96c0b9fba7cc9868d945df88eb42daf7d
Author: Paolo Borelli <pborelli gnome org>
Date:   Sat Apr 11 09:41:50 2015 +0200

    libide: ensure drafts dir exists
    
    https://bugzilla.gnome.org/show_bug.cgi?id=747675

 libide/ide-unsaved-files.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/libide/ide-unsaved-files.c b/libide/ide-unsaved-files.c
index 2888647..2074999 100644
--- a/libide/ide-unsaved-files.c
+++ b/libide/ide-unsaved-files.c
@@ -141,6 +141,18 @@ ide_unsaved_files_save_worker (GTask        *task,
   g_assert (IDE_IS_UNSAVED_FILES (source_object));
   g_assert (state);
 
+  /* ensure that the directory exists */
+  if (g_mkdir_with_parents (state->drafts_directory, 0700) != 0)
+    {
+      int errno;
+
+      error = g_error_new_literal (G_IO_ERROR,
+                                   g_io_error_from_errno (errno),
+                                   "Failed to create drafts directory");
+      g_task_return_error (task, error);
+      return;
+    }
+
   manifest = g_string_new (NULL);
   manifest_path = g_build_filename (state->drafts_directory,
                                     "manifest",


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