[tracker/anonymous-file-nodes: 16/28] Normalize paths so getting the UDI for the mount dir GFile works.



commit c831d004f31adf589c408ce3df9c505ea21977e3
Author: Carlos Garnacho <carlos lanedo com>
Date:   Fri Jan 29 11:38:38 2010 +0100

    Normalize paths so getting the UDI for the mount dir GFile works.
    
    Also, a leak in that function was fixed.

 src/libtracker-common/tracker-storage-hal.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/src/libtracker-common/tracker-storage-hal.c b/src/libtracker-common/tracker-storage-hal.c
index 77e7f5e..32822bd 100644
--- a/src/libtracker-common/tracker-storage-hal.c
+++ b/src/libtracker-common/tracker-storage-hal.c
@@ -1135,6 +1135,16 @@ tracker_storage_get_volume_udi_for_file (TrackerStorage *storage,
 		return NULL;
 	}
 
+	/* Normalize all paths to have a / at the end */
+	if (!g_str_has_suffix (path, G_DIR_SEPARATOR_S)) {
+		gchar *norm_path;
+
+		norm_path = g_strconcat (path, G_DIR_SEPARATOR_S, NULL);
+		g_free (path);
+		path = norm_path;
+	}
+
+
 	priv = GET_PRIV (storage);
 
 	info = find_mount_point_info (priv->mounts, path);
@@ -1147,6 +1157,8 @@ tracker_storage_get_volume_udi_for_file (TrackerStorage *storage,
 	g_debug ("Mount for path '%s' is '%s' (UDI:'%s')",
 	         path, info->mount_point, info->udi);
 
+	g_free (path);
+
 	return info->udi;
 }
 



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