rhythmbox r5890 - in trunk: . lib



Author: jmatthew
Date: Sat Sep  6 13:05:36 2008
New Revision: 5890
URL: http://svn.gnome.org/viewvc/rhythmbox?rev=5890&view=rev

Log:
2008-09-06  Jonathan Matthew  <jonathan d14n org>

	patch partly by: Colin Leroy <colin at colino.net>

	* lib/rb-file-helpers.c: (rb_sanitize_uri_for_filesystem):
	Treat 'msdos' like vfat and fat.

	* lib/rb-util.c: (rb_uri_get_filesystem_type):
	If the URI we're checking doesn't exist, walk up the hierarchy until
	we find something that does.  From #550117.


Modified:
   trunk/ChangeLog
   trunk/lib/rb-file-helpers.c
   trunk/lib/rb-util.c

Modified: trunk/lib/rb-file-helpers.c
==============================================================================
--- trunk/lib/rb-file-helpers.c	(original)
+++ trunk/lib/rb-file-helpers.c	Sat Sep  6 13:05:36 2008
@@ -968,7 +968,8 @@
 		return g_strdup (uri);
 
 	if (!strcmp (filesystem, "fat") ||
-	    !strcmp (filesystem, "vfat") ) {
+	    !strcmp (filesystem, "vfat") ||
+	    !strcmp (filesystem, "msdos")) {
 	    	char *hostname = NULL;
 		GError *error = NULL;
 	    	char *full_path = g_filename_from_uri (uri, &hostname, &error);

Modified: trunk/lib/rb-util.c
==============================================================================
--- trunk/lib/rb-util.c	(original)
+++ trunk/lib/rb-util.c	Sat Sep  6 13:05:36 2008
@@ -324,18 +324,40 @@
 }
 
 char *
-rb_uri_get_filesystem_type(const char *uri)
+rb_uri_get_filesystem_type (const char *uri)
 {
 	GFile *file;
 	GFileInfo *info;
 	char *fstype = NULL;
+	GError *error = NULL;
 
+	/* if the file doesn't exist, walk up the directory structure
+	 * until we find something that does.
+	 */
 	file = g_file_new_for_uri (uri);
-	info = g_file_query_filesystem_info (file, G_FILE_ATTRIBUTE_FILESYSTEM_TYPE, NULL, NULL);
+	info = g_file_query_filesystem_info (file, G_FILE_ATTRIBUTE_FILESYSTEM_TYPE, NULL, &error);
+	while (error != NULL && error->code == G_IO_ERROR_NOT_FOUND) {
+		GFile *parent;
+		
+		g_clear_error (&error);
+		parent = g_file_get_parent (file);
+		g_object_unref (file);
+		file = parent;
+		if (file == NULL) {
+			g_warning ("filesystem root apparently doesn't exist!");
+			return NULL;
+		}
+	
+		info = g_file_query_filesystem_info (file, G_FILE_ATTRIBUTE_FILESYSTEM_TYPE, NULL, &error);
+	}
+
 	if (info != NULL) {
 		fstype = g_file_info_get_attribute_as_string (info, G_FILE_ATTRIBUTE_FILESYSTEM_TYPE);
 		g_object_unref (info);
+	} else {
+		rb_debug ("error querying filesystem info: %s", error->message);
 	}
+	g_clear_error (&error);
 	g_object_unref (file);
 	return fstype;
 }



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