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));
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))
{
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++)
{
{
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 &&
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);
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;
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);
}
else
{
- filepath = concat_dir_and_file(path, list->data);
+ filepath = g_build_filename(path, list->data, NULL);
}
gtk_list_store_append(store, &iter);
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);
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))
}
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);
}
if (path)
{
- fdlg->dest_path = concat_dir_and_file(base, path);
+ fdlg->dest_path = g_build_filename(base, path, NULL);
}
else
{
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);
}
}
{
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;
}
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);
{
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);
}
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);
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);
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);
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)
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)
{
{
gchar *path;
- path = concat_dir_and_file(base, name);
+ path = g_build_filename(base, name, NULL);
if (isdir(path))
{
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))
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;
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)
{