# HG changeset patch # User zas_ # Date 1211368043 0 # Node ID a1dcef8cd1ae2f71df6bc92925caabe41689f874 # Parent eda074e91dddd10361943acd1d8e6a8b175b38a9 Use G_DIR_SEPARATOR where applicable. diff -r eda074e91ddd -r a1dcef8cd1ae src/cache.c --- a/src/cache.c Wed May 21 11:00:13 2008 +0000 +++ b/src/cache.c Wed May 21 11:07:23 2008 +0000 @@ -593,7 +593,7 @@ while (p[0] != '\0') { p++; - if (p[0] == '/' || p[0] == '\0') + if (p[0] == G_DIR_SEPARATOR || p[0] == '\0') { gint end = TRUE; if (p[0] != '\0') @@ -610,7 +610,7 @@ return FALSE; } } - if (!end) p[0] = '/'; + if (!end) p[0] = G_DIR_SEPARATOR; } } } diff -r eda074e91ddd -r a1dcef8cd1ae src/collect-io.c --- a/src/collect-io.c Wed May 21 11:00:13 2008 +0000 +++ b/src/collect-io.c Wed May 21 11:07:23 2008 +0000 @@ -155,7 +155,7 @@ if (!flush) changed |= collect_manager_process_action(entry, &buf); - valid = (buf[0] == '/' && collection_add_check(cd, file_data_new_simple(buf), FALSE, TRUE)); + valid = (buf[0] == G_DIR_SEPARATOR && collection_add_check(cd, file_data_new_simple(buf), FALSE, TRUE)); if (!valid) DEBUG_1("collection invalid file: %s", buf); g_free(buf); diff -r eda074e91ddd -r a1dcef8cd1ae src/collect.c --- a/src/collect.c Wed May 21 11:00:13 2008 +0000 +++ b/src/collect.c Wed May 21 11:07:23 2008 +0000 @@ -1253,7 +1253,7 @@ collection_set_update_info_func(cw->cd, collection_window_update_info, cw); - if (path && *path == '/') collection_load_begin(cw->cd, NULL, COLLECTION_LOAD_NONE); + if (path && *path == G_DIR_SEPARATOR) collection_load_begin(cw->cd, NULL, COLLECTION_LOAD_NONE); return cw; } diff -r eda074e91ddd -r a1dcef8cd1ae src/layout.c --- a/src/layout.c Wed May 21 11:00:13 2008 +0000 +++ b/src/layout.c Wed May 21 11:07:23 2008 +0000 @@ -149,7 +149,7 @@ if ((!lw->path || strcmp(lw->path, buf) != 0) && layout_set_path(lw, buf)) { gint pos = -1; - /* put the '/' back, if we are in tab completion for a dir and result was path change */ + /* put the G_DIR_SEPARATOR back, if we are in tab completion for a dir and result was path change */ gtk_editable_insert_text(GTK_EDITABLE(lw->path_entry), G_DIR_SEPARATOR_S, -1, &pos); gtk_editable_set_position(GTK_EDITABLE(lw->path_entry), strlen(gtk_entry_get_text(GTK_ENTRY(lw->path_entry)))); diff -r eda074e91ddd -r a1dcef8cd1ae src/main.c --- a/src/main.c Wed May 21 11:00:13 2008 +0000 +++ b/src/main.c Wed May 21 11:07:23 2008 +0000 @@ -297,7 +297,7 @@ const gchar *cmd_line = argv[i]; gchar *cmd_all = g_build_filename(base_dir, cmd_line, NULL); - if (cmd_line[0] == '/' && isdir(cmd_line)) + if (cmd_line[0] == G_DIR_SEPARATOR && isdir(cmd_line)) { parse_command_line_process_dir(cmd_line, path, file, &list, &first_dir); } @@ -305,7 +305,7 @@ { parse_command_line_process_dir(cmd_all, path, file, &list, &first_dir); } - else if (cmd_line[0] == '/' && isfile(cmd_line)) + else if (cmd_line[0] == G_DIR_SEPARATOR && isfile(cmd_line)) { parse_command_line_process_file(cmd_line, path, file, &list, collection_list, &first_dir); diff -r eda074e91ddd -r a1dcef8cd1ae src/pan-item.c --- a/src/pan-item.c Wed May 21 11:00:13 2008 +0000 +++ b/src/pan-item.c Wed May 21 11:07:23 2008 +0000 @@ -739,7 +739,7 @@ { gint match = FALSE; - if (path[0] == '/') + if (path[0] == G_DIR_SEPARATOR) { if (pi->fd->path && strcmp(path, pi->fd->path) == 0) match = TRUE; } @@ -785,7 +785,7 @@ GList *list = NULL; if (!path) return NULL; - if (partial && path[0] == '/') return NULL; + if (partial && path[0] == G_DIR_SEPARATOR) return NULL; list = pan_item_find_by_path_l(list, pw->list_static, type, path, ignore_case, partial); list = pan_item_find_by_path_l(list, pw->list, type, path, ignore_case, partial); diff -r eda074e91ddd -r a1dcef8cd1ae src/pan-util.c --- a/src/pan-util.c Wed May 21 11:00:13 2008 +0000 +++ b/src/pan-util.c Wed May 21 11:07:23 2008 +0000 @@ -158,10 +158,10 @@ parse_out_relatives(sl); - if (buf[0] == '/') + if (buf[0] == G_DIR_SEPARATOR) { if (strncmp(sl, buf, l) == 0 && - (sl[l] == '\0' || sl[l] == '/' || l == 1)) ret = TRUE; + (sl[l] == '\0' || sl[l] == G_DIR_SEPARATOR || l == 1)) ret = TRUE; } else { @@ -171,7 +171,7 @@ parse_out_relatives(link_path); if (strncmp(sl, link_path, l) == 0 && - (sl[l] == '\0' || sl[l] == '/' || l == 1)) ret = TRUE; + (sl[l] == '\0' || sl[l] == G_DIR_SEPARATOR || l == 1)) ret = TRUE; g_free(link_path); } diff -r eda074e91ddd -r a1dcef8cd1ae src/pan-view.c --- a/src/pan-view.c Wed May 21 11:00:13 2008 +0000 +++ b/src/pan-view.c Wed May 21 11:07:23 2008 +0000 @@ -1646,7 +1646,7 @@ image_scroll_to_point(pw->imd, pi->x + pi->width / 2, pi->y + pi->height / 2, 0.5, 0.5); buf = g_strdup_printf("%s ( %d / %d )", - (path[0] == '/') ? _("path found") : _("filename found"), + (path[0] == G_DIR_SEPARATOR) ? _("path found") : _("filename found"), g_list_index(list, pi) + 1, g_list_length(list)); pan_search_status(pw, buf); diff -r eda074e91ddd -r a1dcef8cd1ae src/ui_pathsel.c --- a/src/ui_pathsel.c Wed May 21 11:00:13 2008 +0000 +++ b/src/ui_pathsel.c Wed May 21 11:07:23 2008 +0000 @@ -184,7 +184,7 @@ && dir->d_name[0] == '.' && dir->d_name[1] == '\0') continue; if (dir->d_name[0] == '.' && dir->d_name[1] == '.' && dir->d_name[2] == '\0' - && pathl[0] == '/' && pathl[1] == '\0') + && pathl[0] == G_DIR_SEPARATOR && pathl[1] == '\0') continue; /* no .. for root directory */ if (dd->show_hidden || !is_hidden(dir->d_name)) { @@ -1207,7 +1207,7 @@ dd->filter = g_strdup(gtk_entry_get_text(GTK_ENTRY(GTK_BIN(dd->filter_combo)->child))); } - if (path && path[0] == '/' && isdir(path)) + if (path && path[0] == G_DIR_SEPARATOR && isdir(path)) { dest_populate(dd, path); } diff -r eda074e91ddd -r a1dcef8cd1ae src/ui_tabcomp.c --- a/src/ui_tabcomp.c Wed May 21 11:00:13 2008 +0000 +++ b/src/ui_tabcomp.c Wed May 21 11:07:23 2008 +0000 @@ -51,7 +51,7 @@ /* ---------------------------------------------------------------- Tab completion routines, can be connected to any gtkentry widget using the tab_completion_add_to_entry() function. - Use remove_trailing_slash() to strip the trailing '/'. + Use remove_trailing_slash() to strip the trailing G_DIR_SEPARATOR. ----------------------------------------------------------------*/ typedef struct _TabCompData TabCompData; @@ -821,7 +821,7 @@ if (!path) return NULL; l = strlen(path); - while (l > 1 && path[l - 1] == '/') l--; + while (l > 1 && path[l - 1] == G_DIR_SEPARATOR) l--; return g_strndup(path, l); } diff -r eda074e91ddd -r a1dcef8cd1ae src/ui_utildlg.c --- a/src/ui_utildlg.c Wed May 21 11:00:13 2008 +0000 +++ b/src/ui_utildlg.c Wed May 21 11:07:23 2008 +0000 @@ -386,7 +386,7 @@ generic_dialog_attach_default(GENERIC_DIALOG(fdlg), fdlg->entry); gtk_widget_show(tabcomp); - if (path && path[0] == '/') + if (path && path[0] == G_DIR_SEPARATOR) { fdlg->dest_path = g_strdup(path); } diff -r eda074e91ddd -r a1dcef8cd1ae src/utilops.c --- a/src/utilops.c Wed May 21 11:00:13 2008 +0000 +++ b/src/utilops.c Wed May 21 11:07:23 2008 +0000 @@ -1109,7 +1109,7 @@ return; } - if (!fdlg->dest_path || fdlg->dest_path[0] != '/') + if (!fdlg->dest_path || fdlg->dest_path[0] != G_DIR_SEPARATOR) { if (fdlg->source_fd) { @@ -2772,7 +2772,7 @@ if (strlen(name) == 0) return; - if (name[0] == '/') + if (name[0] == G_DIR_SEPARATOR) { gchar *buf; buf = remove_level_from_path(name); diff -r eda074e91ddd -r a1dcef8cd1ae src/view_dir_tree.c --- a/src/view_dir_tree.c Wed May 21 11:00:13 2008 +0000 +++ b/src/view_dir_tree.c Wed May 21 11:07:23 2008 +0000 @@ -206,7 +206,7 @@ strp = path; - if (*strp != '/') return NULL; + if (*strp != G_DIR_SEPARATOR) return NULL; strp++; strb = strp; @@ -214,7 +214,7 @@ while (*strp != '\0') { - if (*strp == '/') + if (*strp == G_DIR_SEPARATOR) { if (l > 0) list = g_list_prepend(list, g_strndup(strb, l)); strp++; @@ -465,14 +465,14 @@ gint n; n = strlen(nd->fd->path); - if (target_path[n] == '/' && target_path[n+1] == '.') + if (target_path[n] == G_DIR_SEPARATOR && target_path[n+1] == '.') { gchar *name8; struct stat sbuf; n++; - while (target_path[n] != '\0' && target_path[n] != '/') n++; + while (target_path[n] != '\0' && target_path[n] != G_DIR_SEPARATOR) n++; name8 = g_strndup(target_path, n); if (stat_utf8(name8, &sbuf)) diff -r eda074e91ddd -r a1dcef8cd1ae src/view_file_list.c --- a/src/view_file_list.c Wed May 21 11:00:13 2008 +0000 +++ b/src/view_file_list.c Wed May 21 11:07:23 2008 +0000 @@ -384,7 +384,7 @@ old_path = g_build_filename(vf->path, old, NULL); new_path = g_build_filename(vf->path, new, NULL); - if (strchr(new, '/') != NULL) + if (strchr(new, G_DIR_SEPARATOR) != NULL) { gchar *text = g_strdup_printf(_("Invalid file name:\n%s"), new); file_util_warning_dialog(_("Error renaming file"), text, GTK_STOCK_DIALOG_ERROR, vf->listview);