diff src/bar_sort.c @ 700:b2eb4ff74d13

Use g_build_filename() to build paths.
author zas_
date Tue, 20 May 2008 21:51:25 +0000
parents 905688aa2317
children e07895754e65
line wrap: on
line diff
--- 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);