# HG changeset patch # User zas_ # Date 1211364716 0 # Node ID 9a145206ec2c000c13dfb31ec5237b92db38bc3e # Parent b736a2e3129becb6ae6773b990ed6cb992cd3daf tab_completion_do(): use g_build_filename(), G_DIR_SEPARATOR, G_DIR_SEPARATOR_S. diff -r b736a2e3129b -r 9a145206ec2c src/ui_tabcomp.c --- a/src/ui_tabcomp.c Wed May 21 09:58:29 2008 +0000 +++ b/src/ui_tabcomp.c Wed May 21 10:11:56 2008 +0000 @@ -379,10 +379,11 @@ g_free(entry_dir); return home_exp; } + if (isdir(entry_dir) && strcmp(entry_file, ".") != 0 && strcmp(entry_file, "..") != 0) { ptr = entry_dir + strlen(entry_dir) - 1; - if (ptr[0] == '/') + if (ptr[0] == G_DIR_SEPARATOR) { if (home_exp) { @@ -398,11 +399,12 @@ const gchar *file; file = td->file_list->data; - buf = g_strconcat(entry_dir, file, NULL); + buf = g_build_filename(entry_dir, file, NULL); if (isdir(buf)) { + gchar *tmp = g_strconcat(buf, G_DIR_SEPARATOR_S, NULL); g_free(buf); - buf = g_strconcat(entry_dir, file, "/", NULL); + buf = tmp; } gtk_entry_set_text(GTK_ENTRY(td->entry), buf); gtk_editable_set_position(GTK_EDITABLE(td->entry), strlen(buf)); @@ -422,7 +424,7 @@ } else { - gchar *buf = g_strconcat(entry_dir, "/", NULL); + gchar *buf = g_strconcat(entry_dir, G_DIR_SEPARATOR_S, NULL); gtk_entry_set_text(GTK_ENTRY(td->entry), buf); gtk_editable_set_position(GTK_EDITABLE(td->entry), strlen(buf)); g_free(buf); @@ -438,7 +440,7 @@ if (strlen(entry_dir) == 0) { g_free(entry_dir); - entry_dir = g_strdup("/"); + entry_dir = g_strdup(G_DIR_SEPARATOR_S); /* FIXME: win32 */ } if (isdir(entry_dir)) @@ -452,7 +454,7 @@ tab_completion_read_dir(td, entry_dir); } - if (strcmp(entry_dir, "/") == 0) entry_dir[0] = '\0'; + if (strcmp(entry_dir, G_DIR_SEPARATOR_S) == 0) entry_dir[0] = '\0'; /* FIXME: win32 */ list = td->file_list; while (list) @@ -472,12 +474,13 @@ gchar *file = poss->data; gchar *buf; - buf = g_strconcat(entry_dir, "/", file, NULL); + buf = g_build_filename(entry_dir, file, NULL); if (isdir(buf)) { + gchar *tmp = g_strconcat(buf, G_DIR_SEPARATOR_S, NULL); g_free(buf); - buf = g_strconcat(entry_dir, "/", file, "/", NULL); + buf = tmp; } gtk_entry_set_text(GTK_ENTRY(td->entry), buf); gtk_editable_set_position(GTK_EDITABLE(td->entry), strlen(buf)); @@ -514,7 +517,7 @@ gchar *buf; file = g_strdup(test_file); file[c] = '\0'; - buf = g_strconcat(entry_dir, "/", file, NULL); + buf = g_build_filename(entry_dir, file, NULL); gtk_entry_set_text(GTK_ENTRY(td->entry), buf); gtk_editable_set_position(GTK_EDITABLE(td->entry), strlen(buf));