changeset 700:b2eb4ff74d13

Use g_build_filename() to build paths.
author zas_
date Tue, 20 May 2008 21:51:25 +0000
parents 9873d695a9c1
children 28af4b6dd9ef
files src/bar_info.c src/bar_sort.c
diffstat 2 files changed, 11 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/src/bar_info.c	Tue May 20 20:11:29 2008 +0000
+++ b/src/bar_info.c	Tue May 20 21:51:25 2008 +0000
@@ -101,8 +101,10 @@
 		comment_dir = cache_get_location(CACHE_TYPE_METADATA, fd->path, FALSE, &mode);
 		if (cache_ensure_dir_exists(comment_dir, mode))
 			{
-			comment_path = g_strconcat(comment_dir, "/", fd->name,
-						   GQ_CACHE_EXT_METADATA, NULL);
+			gchar *filename = g_strconcat(fd->name, GQ_CACHE_EXT_METADATA, NULL);
+			
+			comment_path = g_build_filename(comment_dir, filename, NULL);
+			g_free(filename);
 			}
 		g_free(comment_dir);
 		}
--- a/src/bar_sort.c	Tue May 20 20:11:29 2008 +0000
+++ b/src/bar_sort.c	Tue May 20 21:51:25 2008 +0000
@@ -94,7 +94,7 @@
 	history_list_free_key(SORT_KEY_COLLECTIONS);
 	bookmark_list_set_key(bookmarks, SORT_KEY_COLLECTIONS);
 
-	collect_path = g_strconcat(homedir(), "/", GQ_RC_DIR_COLLECTIONS, NULL);
+	collect_path = g_build_filename(homedir(), GQ_RC_DIR_COLLECTIONS, NULL);
 	filelist_read(collect_path, &list, NULL);
 	g_free(collect_path);
 
@@ -433,20 +433,17 @@
 	else
 		{
 		gchar *path;
-		gchar *ext;
-
+	
 		if (strlen(name) == 0) return;
 
-		if (file_extension_match(name, ".gqv"))
+		if (!file_extension_match(name, ".gqv"))
 			{
-			ext = NULL;
-			}
-		else
-			{
-			ext = ".gqv";
+			gchar *tmp = g_strconcat(name, ".gqv", NULL);
+			g_free((gpointer) name);
+			name = tmp;
 			}
 
-		path = g_strconcat(homedir(), "/", GQ_RC_DIR_COLLECTIONS, "/", name, ext, NULL);
+		path = g_build_filename(homedir(), GQ_RC_DIR_COLLECTIONS, name, NULL);
 		if (isfile(path))
 			{
 			gchar *text = g_strdup_printf(_("The collection:\n%s\nalready exists."), name);