[brasero: 4/5] Fix data project loading



commit 3d7b32946e1e93c6fe6f8dcc4a7502f0bcb8364e
Author: Philippe Rouquier <bonfire-app wanadoo fr>
Date:   Tue May 19 08:31:35 2009 +0200

    Fix data project loading
    Handle the cases where directory paths end with a slash
---
 libbrasero-burn/brasero-data-project.c |   21 ++++++++++++++++++---
 1 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/libbrasero-burn/brasero-data-project.c b/libbrasero-burn/brasero-data-project.c
index 11473e1..71dba08 100644
--- a/libbrasero-burn/brasero-data-project.c
+++ b/libbrasero-burn/brasero-data-project.c
@@ -3230,6 +3230,7 @@ brasero_data_project_load_contents (BraseroDataProject *self,
 	for (iter = grafts; iter; iter = iter->next) {
 		BraseroGraftPt *graft;
 		GFile *file;
+		gchar *path;
 		gchar *uri;
 
 		graft = iter->data;
@@ -3242,13 +3243,27 @@ brasero_data_project_load_contents (BraseroDataProject *self,
 		else
 			uri = NULL;
 
+		if (graft->path) {
+			/* This might happen if we are loading brasero projects */
+			if (g_str_has_suffix (graft->path, G_DIR_SEPARATOR_S)) {
+				int len;
+
+				len = strlen (graft->path);
+				path = g_strndup (graft->path, len - 1);
+			}
+			else
+				path = g_strdup (graft->path);
+		}
+		else
+			path = NULL;
+
 		folders = brasero_data_project_add_path (self,
-							 graft->path,
+							 path,
 							 uri,
 							 folders);
 
-		if (uri)
-			g_free (uri);
+		g_free (path);
+		g_free (uri);
 	}
 
 	for (iter = excluded; iter; iter = iter->next) {



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