changeset 1385:b4e6fee484f7

Fix utf8/locale conversion warning: the path passed to isdir() is not in UTF8 (if local fs is not in UFT8) so do not use it (isdir() uses stat_utf8() which calls path_from_utf8()).
author zas_
date Fri, 06 Mar 2009 14:53:32 +0000
parents 99eae1622e0c
children 4da6d326919c
files src/ui_tabcomp.c
diffstat 1 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/ui_tabcomp.c	Fri Mar 06 14:42:32 2009 +0000
+++ b/src/ui_tabcomp.c	Fri Mar 06 14:53:32 2009 +0000
@@ -113,10 +113,10 @@
 
 	pathl = path_from_utf8(path);
 	dp = opendir(pathl);
-	g_free(pathl);
 	if (!dp)
 		{
 		/* dir not found */
+		g_free(pathl);
 		return;
 		}
 	while ((dir = readdir(dp)) != NULL)
@@ -124,9 +124,9 @@
 		gchar *name = dir->d_name;
 		if (strcmp(name, ".") != 0 && strcmp(name, "..") != 0)
 			{
-			gchar *abspath = g_build_filename(path, name, NULL);
+			gchar *abspath = g_build_filename(pathl, name, NULL);
 
-			if (isdir(abspath))
+			if (g_file_test(abspath, G_FILE_TEST_IS_DIR))
 				{
 				gchar *dname = g_strconcat(name, G_DIR_SEPARATOR_S, NULL);
 				list = g_list_prepend(list, path_to_utf8(dname));
@@ -143,6 +143,7 @@
 
 	td->dir_path = g_strdup(path);
 	td->file_list = list;
+	g_free(pathl);
 }
 
 static void tab_completion_destroy(GtkWidget *widget, gpointer data)