# HG changeset patch # User zas_ # Date 1211321344 0 # Node ID e07895754e65720fb638ee3e5e6c5f1352b6795a # Parent 28af4b6dd9efe06f855359db646fc36b160607b2 Drop concat_dir_and_file() and use g_build_filename() instead. diff -r 28af4b6dd9ef -r e07895754e65 src/bar_sort.c --- a/src/bar_sort.c Tue May 20 22:00:14 2008 +0000 +++ b/src/bar_sort.c Tue May 20 22:09:04 2008 +0000 @@ -272,7 +272,7 @@ if (!isdir(path)) return; - dest_path = concat_dir_and_file(path, source->name); + dest_path = g_build_filename(path, source->name, NULL); bar_sort_undo_set(sd, NULL, source, dest_path); list = g_list_append(NULL, file_data_ref(source)); diff -r 28af4b6dd9ef -r e07895754e65 src/main.c --- a/src/main.c Tue May 20 22:00:14 2008 +0000 +++ b/src/main.c Tue May 20 22:09:04 2008 +0000 @@ -295,7 +295,7 @@ while (i < argc) { const gchar *cmd_line = argv[i]; - gchar *cmd_all = concat_dir_and_file(base_dir, cmd_line); + gchar *cmd_all = g_build_filename(base_dir, cmd_line, NULL); if (cmd_line[0] == '/' && isdir(cmd_line)) { @@ -560,15 +560,15 @@ editor_reset_defaults(); bookmark_add_default(_("Home"), homedir()); - path = concat_dir_and_file(homedir(), "Desktop"); + path = g_build_filename(homedir(), "Desktop", NULL); bookmark_add_default(_("Desktop"), path); g_free(path); - path = concat_dir_and_file(homedir(), GQ_RC_DIR_COLLECTIONS); + path = g_build_filename(homedir(), GQ_RC_DIR_COLLECTIONS, NULL); bookmark_add_default(_("Collections"), path); g_free(path); g_free(options->file_ops.safe_delete_path); - options->file_ops.safe_delete_path = concat_dir_and_file(homedir(), GQ_RC_DIR_TRASH); + options->file_ops.safe_delete_path = g_build_filename(homedir(), GQ_RC_DIR_TRASH, NULL); for (i = 0; i < COLOR_PROFILE_INPUTS; i++) { diff -r 28af4b6dd9ef -r e07895754e65 src/pan-util.c --- a/src/pan-util.c Tue May 20 22:00:14 2008 +0000 +++ b/src/pan-util.c Tue May 20 22:09:04 2008 +0000 @@ -167,7 +167,7 @@ { gchar *link_path; - link_path = concat_dir_and_file(sl, buf); + link_path = g_build_filename(sl, buf, NULL); parse_out_relatives(link_path); if (strncmp(sl, link_path, l) == 0 && diff -r 28af4b6dd9ef -r e07895754e65 src/ui_bookmark.c --- a/src/ui_bookmark.c Tue May 20 22:00:14 2008 +0000 +++ b/src/ui_bookmark.c Tue May 20 22:09:04 2008 +0000 @@ -856,7 +856,7 @@ history_list_add_to_key(bm->key, buf, 0); g_free(buf); - path = concat_dir_and_file(homedir(), "Desktop"); + path = g_build_filename(homedir(), "Desktop", NULL); if (isname(path)) { buf = bookmark_string(_("Desktop"), path, NULL); diff -r 28af4b6dd9ef -r e07895754e65 src/ui_fileops.c --- a/src/ui_fileops.c Tue May 20 22:00:14 2008 +0000 +++ b/src/ui_fileops.c Tue May 20 22:09:04 2008 +0000 @@ -618,15 +618,6 @@ return g_strndup(path, (gsize) n); } -gchar *concat_dir_and_file(const gchar *base, const gchar *name) -{ - if (!base || !name) return NULL; - - if (strcmp(base, "/") == 0) return g_strconcat(base, name, NULL); - - return g_strconcat(base, "/", name, NULL); -} - const gchar *extension_from_path(const gchar *path) { if (!path) return NULL; diff -r 28af4b6dd9ef -r e07895754e65 src/ui_fileops.h --- a/src/ui_fileops.h Tue May 20 22:00:14 2008 +0000 +++ b/src/ui_fileops.h Tue May 20 22:09:04 2008 +0000 @@ -66,7 +66,6 @@ const gchar *filename_from_path(const gchar *path); gchar *remove_level_from_path(const gchar *path); -gchar *concat_dir_and_file(const gchar *base, const gchar *name); const gchar *extension_from_path(const gchar *path); gchar *remove_extension_from_path(const gchar *path); diff -r 28af4b6dd9ef -r e07895754e65 src/ui_pathsel.c --- a/src/ui_pathsel.c Tue May 20 22:00:14 2008 +0000 +++ b/src/ui_pathsel.c Tue May 20 22:09:04 2008 +0000 @@ -231,7 +231,7 @@ } else { - filepath = concat_dir_and_file(path, list->data); + filepath = g_build_filename(path, list->data, NULL); } gtk_list_store_append(store, &iter); @@ -256,7 +256,7 @@ gchar *filepath; const gchar *name = list->data; - filepath = concat_dir_and_file(path, name); + filepath = g_build_filename(path, name, NULL); gtk_list_store_append(store, &iter); gtk_list_store_set(store, &iter, 0, name, 1, filepath, -1); @@ -424,7 +424,7 @@ if (!old_path) return FALSE; buf = remove_level_from_path(old_path); - new_path = concat_dir_and_file(buf, new); + new_path = g_build_filename(buf, new, NULL); g_free(buf); if (isname(new_path)) @@ -745,7 +745,7 @@ } else { - buf = concat_dir_and_file(dd->path, _("New folder")); + buf = g_build_filename(dd->path, _("New folder"), NULL); path = unique_filename(buf, NULL, " ", FALSE); g_free(buf); } diff -r 28af4b6dd9ef -r e07895754e65 src/ui_utildlg.c --- a/src/ui_utildlg.c Tue May 20 22:00:14 2008 +0000 +++ b/src/ui_utildlg.c Tue May 20 22:09:04 2008 +0000 @@ -401,7 +401,7 @@ if (path) { - fdlg->dest_path = concat_dir_and_file(base, path); + fdlg->dest_path = g_build_filename(base, path, NULL); } else { diff -r 28af4b6dd9ef -r e07895754e65 src/utilops.c --- a/src/utilops.c Tue May 20 22:00:14 2008 +0000 +++ b/src/utilops.c Tue May 20 22:09:04 2008 +0000 @@ -542,7 +542,7 @@ else { g_free(fdm->dest); - fdm->dest = concat_dir_and_file(fdm->dest_base, name); + fdm->dest = g_build_filename(fdm->dest_base, name, NULL); fdm->confirmed = !isname(fdm->dest); } } @@ -705,7 +705,7 @@ { GList *work = fdm->source_next; fdm->source_fd = work->data; - fdm->dest = concat_dir_and_file(fdm->dest_base, fdm->source_fd->name); + fdm->dest = g_build_filename(fdm->dest_base, fdm->source_fd->name, NULL); fdm->source_next = work->next; fdm->confirmed = FALSE; } @@ -905,7 +905,7 @@ base = remove_level_from_path(fds->dest); g_free(fds->dest); - fds->dest = concat_dir_and_file(base, name); + fds->dest = g_build_filename(base, name, NULL); fds->confirmed = !isname(fds->dest); g_free(base); @@ -1077,7 +1077,7 @@ { if (isdir(fdlg->dest_path)) { - gchar *buf = concat_dir_and_file(fdlg->dest_path, fdlg->source_fd->name); + gchar *buf = g_build_filename(fdlg->dest_path, fdlg->source_fd->name, NULL); gtk_entry_set_text(GTK_ENTRY(fdlg->entry), buf); g_free(buf); } @@ -1117,7 +1117,7 @@ gchar *path; base = remove_level_from_path(fdlg->source_fd->path); - path = concat_dir_and_file(base, fdlg->dest_path); + path = g_build_filename(base, fdlg->dest_path, NULL); gtk_entry_set_text(GTK_ENTRY(fdlg->entry), path); @@ -1288,7 +1288,7 @@ gchar *dest; source_fd = list->data; - dest = concat_dir_and_file(dest_path, source_fd->name); + dest = g_build_filename(dest_path, source_fd->name, NULL); file_util_move_single(file_data_single_new(source_fd, dest, FALSE)); g_free(dest); @@ -1314,7 +1314,7 @@ gchar *dest; source_fd = list->data; - dest = concat_dir_and_file(dest_path, source_fd->name); + dest = g_build_filename(dest_path, source_fd->name, NULL); file_util_move_single(file_data_single_new(source_fd, dest, TRUE)); g_free(dest); @@ -2183,7 +2183,7 @@ base = remove_level_from_path(fdlg->source_fd->path); g_free(fdlg->dest_path); - fdlg->dest_path = concat_dir_and_file(base, name); + fdlg->dest_path = g_build_filename(base, name, NULL); g_free(base); if (strlen(name) == 0 || strcmp(fdlg->source_fd->path, fdlg->dest_path) == 0) @@ -2644,7 +2644,7 @@ gchar *path; name = gtk_entry_get_text(GTK_ENTRY(fdlg->entry)); - path = concat_dir_and_file(fdlg->dest_path, name); + path = g_build_filename(fdlg->dest_path, name, NULL); if (strlen(name) == 0 || strcmp(fdlg->source_fd->path, path) == 0) { @@ -2729,7 +2729,7 @@ { gchar *path; - path = concat_dir_and_file(base, name); + path = g_build_filename(base, name, NULL); if (isdir(path)) { diff -r 28af4b6dd9ef -r e07895754e65 src/view_dir.c --- a/src/view_dir.c Tue May 20 22:00:14 2008 +0000 +++ b/src/view_dir.c Tue May 20 22:09:04 2008 +0000 @@ -218,7 +218,7 @@ old_path = g_strdup(fd->path); base = remove_level_from_path(old_path); - new_path = concat_dir_and_file(base, new); + new_path = g_build_filename(base, new, NULL); g_free(base); if (file_util_rename_dir(fd, new_path, vd->view)) @@ -499,7 +499,7 @@ break; } - buf = concat_dir_and_file(path, _("new_folder")); + buf = g_build_filename(path, _("new_folder"), NULL); new_path = unique_filename(buf, NULL, NULL, FALSE); g_free(buf); if (!new_path) return; diff -r 28af4b6dd9ef -r e07895754e65 src/view_file_list.c --- a/src/view_file_list.c Tue May 20 22:00:14 2008 +0000 +++ b/src/view_file_list.c Tue May 20 22:09:04 2008 +0000 @@ -381,8 +381,8 @@ if (strlen(new) == 0) return FALSE; - old_path = concat_dir_and_file(vf->path, old); - new_path = concat_dir_and_file(vf->path, new); + old_path = g_build_filename(vf->path, old, NULL); + new_path = g_build_filename(vf->path, new, NULL); if (strchr(new, '/') != NULL) {