[sound-juicer/wip/gsettings] Check base_uri is a directory



commit a25f084cc8d3b206ec4c831d1731954d3d13365f
Author: Phillip Wood <phillip wood dunelm org uk>
Date:   Fri Sep 20 10:46:44 2013 +0100

    Check base_uri is a directory
    
    https://bugzilla.gnome.org/show_bug.cgi?id=625897

 src/sj-main.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/src/sj-main.c b/src/sj-main.c
index 4d5d03c..2ecd1ec 100644
--- a/src/sj-main.c
+++ b/src/sj-main.c
@@ -1083,10 +1083,15 @@ static void baseuri_changed_cb (GSettings *settings, gchar *key, gpointer user_d
   if ((value == NULL) || (*value == '\0')) {
     base_uri = sj_get_default_music_directory ();
   } else {
+    GFileType file_type;
     base_uri = g_file_new_for_uri (value);
+    file_type = g_file_query_file_type (base_uri, G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, NULL);
+    if (file_type != G_FILE_TYPE_DIRECTORY) {
+      g_object_unref (base_uri);
+      base_uri = sj_get_default_music_directory ();
+    }
   }
   g_free (value);
-  /* TODO: sanity check the URI somewhat */
 }
 
 /**


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