comparison src/ui_tabcomp.c @ 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 31a747f9d268
children 2496a345c452
comparison
equal deleted inserted replaced
1384:99eae1622e0c 1385:b4e6fee484f7
111 111
112 tab_completion_free_list(td); 112 tab_completion_free_list(td);
113 113
114 pathl = path_from_utf8(path); 114 pathl = path_from_utf8(path);
115 dp = opendir(pathl); 115 dp = opendir(pathl);
116 g_free(pathl);
117 if (!dp) 116 if (!dp)
118 { 117 {
119 /* dir not found */ 118 /* dir not found */
119 g_free(pathl);
120 return; 120 return;
121 } 121 }
122 while ((dir = readdir(dp)) != NULL) 122 while ((dir = readdir(dp)) != NULL)
123 { 123 {
124 gchar *name = dir->d_name; 124 gchar *name = dir->d_name;
125 if (strcmp(name, ".") != 0 && strcmp(name, "..") != 0) 125 if (strcmp(name, ".") != 0 && strcmp(name, "..") != 0)
126 { 126 {
127 gchar *abspath = g_build_filename(path, name, NULL); 127 gchar *abspath = g_build_filename(pathl, name, NULL);
128 128
129 if (isdir(abspath)) 129 if (g_file_test(abspath, G_FILE_TEST_IS_DIR))
130 { 130 {
131 gchar *dname = g_strconcat(name, G_DIR_SEPARATOR_S, NULL); 131 gchar *dname = g_strconcat(name, G_DIR_SEPARATOR_S, NULL);
132 list = g_list_prepend(list, path_to_utf8(dname)); 132 list = g_list_prepend(list, path_to_utf8(dname));
133 g_free(dname); 133 g_free(dname);
134 } 134 }
141 } 141 }
142 closedir(dp); 142 closedir(dp);
143 143
144 td->dir_path = g_strdup(path); 144 td->dir_path = g_strdup(path);
145 td->file_list = list; 145 td->file_list = list;
146 g_free(pathl);
146 } 147 }
147 148
148 static void tab_completion_destroy(GtkWidget *widget, gpointer data) 149 static void tab_completion_destroy(GtkWidget *widget, gpointer data)
149 { 150 {
150 TabCompData *td = data; 151 TabCompData *td = data;