diff options
author | Phillip Wood <phillip.wood@dunelm.org.uk> | 2013-09-20 10:46:44 +0100 |
---|---|---|
committer | Christophe Fergeau <cfergeau@redhat.com> | 2014-01-23 16:15:34 +0100 |
commit | 3e6a3e76ac0cec89f5ea4bdc7a7fabbf94e1f679 (patch) | |
tree | 434061ba8d4253d1496adc0b3f5dd8a7de502955 | |
parent | d3369fd32aa406284b290d02f2d3bdbffcb11e2f (diff) |
Check base_uri is a directory
https://bugzilla.gnome.org/show_bug.cgi?id=625897
-rw-r--r-- | 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 cf10402..55bbbb1 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 (sj_str_is_empty (value)) { 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 */ } /** |