2 * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3 * Copyright (C) 1999-2002 Hiroyuki Yamamoto
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
36 # include <sys/time.h>
43 #include "procheader.h"
46 static void mh_folder_init (Folder *folder,
50 GSList *mh_get_msg_list (Folder *folder,
53 gchar *mh_fetch_msg (Folder *folder,
56 MsgInfo *mh_get_msginfo (Folder *folder,
59 gint mh_add_msg (Folder *folder,
62 gboolean remove_source);
63 gint mh_move_msg (Folder *folder,
66 gint mh_move_msgs_with_dest (Folder *folder,
69 gint mh_copy_msg (Folder *folder,
72 gint mh_copy_msgs_with_dest (Folder *folder,
75 gint mh_remove_msg (Folder *folder,
78 gint mh_remove_all_msg (Folder *folder,
80 gboolean mh_is_msg_changed (Folder *folder,
84 gint mh_scan_folder (Folder *folder,
86 gint mh_get_num_list (Folder *folder,
89 void mh_scan_tree (Folder *folder);
91 gint mh_create_tree (Folder *folder);
92 FolderItem *mh_create_folder (Folder *folder,
95 gint mh_rename_folder (Folder *folder,
98 gint mh_remove_folder (Folder *folder,
101 gchar *mh_get_new_msg_filename (FolderItem *dest);
103 static MsgInfo *mh_parse_msg (const gchar *file,
105 static void mh_scan_tree_recursive (FolderItem *item);
107 static gboolean mh_rename_folder_func (GNode *node,
111 FolderClass mh_class =
123 mh_move_msgs_with_dest,
125 mh_copy_msgs_with_dest,
145 FolderClass *mh_get_class()
150 Folder *mh_folder_new(const gchar *name, const gchar *path)
154 folder = (Folder *)g_new0(MHFolder, 1);
155 folder->class = &mh_class;
156 mh_folder_init(folder, name, path);
161 void mh_folder_destroy(Folder *folder)
163 folder_local_folder_destroy(LOCAL_FOLDER(folder));
166 static void mh_folder_init(Folder *folder, const gchar *name, const gchar *path)
168 folder_local_folder_init(folder, name, path);
172 void mh_get_last_num(Folder *folder, FolderItem *item)
181 g_return_if_fail(item != NULL);
183 debug_print("mh_get_last_num(): Scanning %s ...\n", item->path);
185 path = folder_item_get_path(item);
186 g_return_if_fail(path != NULL);
187 if (change_dir(path) < 0) {
193 if ((dp = opendir(".")) == NULL) {
194 FILE_OP_ERROR(item->path, "opendir");
198 while ((d = readdir(dp)) != NULL) {
199 if ((num = to_number(d->d_name)) >= 0 &&
200 stat(d->d_name, &s) == 0 &&
201 S_ISREG(s.st_mode)) {
208 debug_print("Last number in dir %s = %d\n", item->path, max);
209 item->last_num = max;
212 gint mh_get_num_list(Folder *folder, FolderItem *item, GSList **list)
219 gint num, nummsgs = 0;
221 g_return_val_if_fail(item != NULL, -1);
223 debug_print("mh_get_last_num(): Scanning %s ...\n", item->path);
225 path = folder_item_get_path(item);
226 g_return_val_if_fail(path != NULL, -1);
227 if (change_dir(path) < 0) {
233 if ((dp = opendir(".")) == NULL) {
234 FILE_OP_ERROR(item->path, "opendir");
238 while ((d = readdir(dp)) != NULL) {
239 if ((num = to_number(d->d_name)) >= 0 &&
240 stat(d->d_name, &s) == 0 &&
241 S_ISREG(s.st_mode)) {
242 *list = g_slist_prepend(*list, GINT_TO_POINTER(num));
251 gchar *mh_fetch_msg(Folder *folder, FolderItem *item, gint num)
256 g_return_val_if_fail(item != NULL, NULL);
257 g_return_val_if_fail(num > 0, NULL);
259 path = folder_item_get_path(item);
260 file = g_strconcat(path, G_DIR_SEPARATOR_S, itos(num), NULL);
262 if (!is_file_exist(file)) {
270 MsgInfo *mh_get_msginfo(Folder *folder, FolderItem *item, gint num)
275 g_return_val_if_fail(item != NULL, NULL);
276 g_return_val_if_fail(num > 0, NULL);
278 file = mh_fetch_msg(folder, item, num);
279 if (!file) return NULL;
281 msginfo = mh_parse_msg(file, item);
283 msginfo->msgnum = num;
290 gchar *mh_get_new_msg_filename(FolderItem *dest)
295 destpath = folder_item_get_path(dest);
296 g_return_val_if_fail(destpath != NULL, NULL);
298 if (!is_dir_exist(destpath))
299 make_dir_hier(destpath);
302 destfile = g_strdup_printf("%s%c%d", destpath, G_DIR_SEPARATOR,
304 if (is_file_entry_exist(destfile)) {
316 #define SET_DEST_MSG_FLAGS(fp, dest, msginfo) \
318 MsgInfo newmsginfo; \
320 newmsginfo.msgnum = dest->last_num; \
321 newmsginfo.flags = msginfo->flags; \
322 if (dest->stype == F_OUTBOX || \
323 dest->stype == F_QUEUE || \
324 dest->stype == F_DRAFT || \
325 dest->stype == F_TRASH) \
326 MSG_UNSET_PERM_FLAGS(newmsginfo.flags, \
327 MSG_NEW|MSG_UNREAD|MSG_DELETED); \
329 procmsg_write_flags(&newmsginfo, fp); \
332 gint mh_add_msg(Folder *folder, FolderItem *dest, const gchar *file,
333 gboolean remove_source)
337 g_return_val_if_fail(dest != NULL, -1);
338 g_return_val_if_fail(file != NULL, -1);
340 if (dest->last_num < 0) {
341 mh_get_last_num(folder, dest);
342 if (dest->last_num < 0) return -1;
345 destfile = mh_get_new_msg_filename(dest);
346 g_return_val_if_fail(destfile != NULL, -1);
348 if (link(file, destfile) < 0) {
349 if (copy_file(file, destfile, TRUE) < 0) {
350 g_warning("can't copy message %s to %s\n",
358 if (unlink(file) < 0)
359 FILE_OP_ERROR(file, "unlink");
364 return dest->last_num;
367 static gint mh_do_move(Folder *folder, FolderItem *dest, MsgInfo *msginfo)
372 PrefsFolderItem *prefs;
374 g_return_val_if_fail(dest != NULL, -1);
375 g_return_val_if_fail(msginfo != NULL, -1);
377 if (msginfo->folder == dest) {
378 g_warning("the src folder is identical to the dest.\n");
382 if (dest->last_num < 0) {
383 mh_get_last_num(folder, dest);
384 if (dest->last_num < 0) return -1;
389 destfile = mh_get_new_msg_filename(dest);
390 if (!destfile) return -1;
392 srcfile = procmsg_get_message_file(msginfo);
394 debug_print("Moving message %s%c%d to %s ...\n",
395 msginfo->folder->path, G_DIR_SEPARATOR,
396 msginfo->msgnum, dest->path);
398 if (move_file(srcfile, destfile, FALSE) < 0) {
404 if (prefs && prefs->enable_folder_chmod && prefs->folder_chmod) {
405 if (chmod(destfile, prefs->folder_chmod) < 0)
406 FILE_OP_ERROR(destfile, "chmod");
409 filemode = prefs->folder_chmod;
410 if (filemode & S_IRGRP) filemode |= S_IWGRP;
411 if (filemode & S_IROTH) filemode |= S_IWOTH;
418 return dest->last_num;
421 gint mh_move_msg(Folder *folder, FolderItem *dest, MsgInfo *msginfo)
426 g_return_val_if_fail(folder != NULL, -1);
427 g_return_val_if_fail(dest != NULL, -1);
428 g_return_val_if_fail(msginfo != NULL, -1);
429 g_return_val_if_fail(msginfo->folder != NULL, -1);
431 if (folder == msginfo->folder->folder)
432 return mh_do_move(folder, dest, msginfo);
434 srcfile = procmsg_get_message_file(msginfo);
435 if (!srcfile) return -1;
437 ret = mh_add_msg(folder, dest, srcfile, FALSE);
441 ret = folder_item_remove_msg(msginfo->folder, msginfo->msgnum);
446 static gint mh_do_move_msgs_with_dest(Folder *folder, FolderItem *dest,
453 PrefsFolderItem *prefs;
455 g_return_val_if_fail(dest != NULL, -1);
456 g_return_val_if_fail(msglist != NULL, -1);
458 if (dest->last_num < 0) {
459 mh_get_last_num(folder, dest);
460 if (dest->last_num < 0) return -1;
465 for (cur = msglist; cur != NULL; cur = cur->next) {
466 msginfo = (MsgInfo *)cur->data;
468 if (msginfo->folder == dest) {
469 g_warning("the src folder is identical to the dest.\n");
472 debug_print("Moving message %s%c%d to %s ...\n",
473 msginfo->folder->path, G_DIR_SEPARATOR,
474 msginfo->msgnum, dest->path);
476 destfile = mh_get_new_msg_filename(dest);
477 if (!destfile) return -1;
478 srcfile = procmsg_get_message_file(msginfo);
480 if (move_file(srcfile, destfile, FALSE) < 0) {
491 return dest->last_num;
494 gint mh_move_msgs_with_dest(Folder *folder, FolderItem *dest, GSList *msglist)
500 msginfo = (MsgInfo *)msglist->data;
501 if (folder == msginfo->folder->folder)
502 return mh_do_move_msgs_with_dest(folder, dest, msglist);
504 for (cur = msglist; cur != NULL; cur = cur->next) {
505 msginfo = (MsgInfo *)cur->data;
506 ret = mh_move_msg(folder, dest, msginfo);
507 if (ret == -1) break;
513 gint mh_copy_msg(Folder *folder, FolderItem *dest, MsgInfo *msginfo)
518 PrefsFolderItem *prefs;
520 g_return_val_if_fail(dest != NULL, -1);
521 g_return_val_if_fail(msginfo != NULL, -1);
523 if (msginfo->folder == dest) {
524 g_warning("the src folder is identical to the dest.\n");
528 if (dest->last_num < 0) {
529 mh_get_last_num(folder, dest);
530 if (dest->last_num < 0) return -1;
535 srcfile = procmsg_get_message_file(msginfo);
536 destfile = mh_get_new_msg_filename(dest);
542 debug_print("Copying message %s%c%d to %s ...\n",
543 msginfo->folder->path, G_DIR_SEPARATOR,
544 msginfo->msgnum, dest->path);
547 if ((MSG_IS_QUEUED(msginfo->flags) || MSG_IS_DRAFT(msginfo->flags))
548 && dest->stype != F_QUEUE && dest->stype != F_DRAFT) {
549 if (procmsg_remove_special_headers(srcfile, destfile) !=0) {
554 } else if (copy_file(srcfile, destfile, TRUE) < 0) {
555 FILE_OP_ERROR(srcfile, "copy");
562 if (prefs && prefs->enable_folder_chmod && prefs->folder_chmod) {
563 if (chmod(destfile, prefs->folder_chmod) < 0)
564 FILE_OP_ERROR(destfile, "chmod");
567 filemode = prefs->folder_chmod;
568 if (filemode & S_IRGRP) filemode |= S_IWGRP;
569 if (filemode & S_IROTH) filemode |= S_IWOTH;
576 return dest->last_num;
580 gint mh_copy_msg(Folder *folder, FolderItem *dest, MsgInfo *msginfo)
588 src_folder = msginfo->folder->folder;
590 g_return_val_if_fail(src_folder->fetch_msg != NULL, -1);
592 filename = src_folder->fetch_msg(src_folder,
595 if (filename == NULL)
598 num = folder->add_msg(folder, dest, filename, FALSE);
600 destdir = folder_item_get_path(dest);
605 newmsginfo.msgnum = dest->last_num;
606 newmsginfo.flags = msginfo->flags;
607 if (dest->stype == F_OUTBOX ||
608 dest->stype == F_QUEUE ||
609 dest->stype == F_DRAFT ||
610 dest->stype == F_TRASH)
611 MSG_UNSET_FLAGS(newmsginfo.flags,
612 MSG_NEW|MSG_UNREAD|MSG_DELETED);
614 procmsg_write_flags(&newmsginfo, fp);
622 gint mh_copy_msgs_with_dest(Folder *folder, FolderItem *dest, GSList *msglist)
629 g_return_val_if_fail(dest != NULL, -1);
630 g_return_val_if_fail(msglist != NULL, -1);
632 if (dest->last_num < 0) {
633 mh_get_last_num(folder, dest);
634 if (dest->last_num < 0) return -1;
637 for (cur = msglist; cur != NULL; cur = cur->next) {
638 msginfo = (MsgInfo *)cur->data;
640 if (msginfo->folder == dest) {
641 g_warning("the src folder is identical to the dest.\n");
644 debug_print("Copying message %s%c%d to %s ...\n",
645 msginfo->folder->path, G_DIR_SEPARATOR,
646 msginfo->msgnum, dest->path);
648 destfile = mh_get_new_msg_filename(dest);
649 if (!destfile) break;
650 srcfile = procmsg_get_message_file(msginfo);
652 if (copy_file(srcfile, destfile, TRUE) < 0) {
653 FILE_OP_ERROR(srcfile, "copy");
664 return dest->last_num;
667 gint mh_remove_msg(Folder *folder, FolderItem *item, gint num)
671 g_return_val_if_fail(item != NULL, -1);
673 file = mh_fetch_msg(folder, item, num);
674 g_return_val_if_fail(file != NULL, -1);
676 if (unlink(file) < 0) {
677 FILE_OP_ERROR(file, "unlink");
686 gint mh_remove_all_msg(Folder *folder, FolderItem *item)
691 g_return_val_if_fail(item != NULL, -1);
693 path = folder_item_get_path(item);
694 g_return_val_if_fail(path != NULL, -1);
695 val = remove_all_numbered_files(path);
701 gboolean mh_is_msg_changed(Folder *folder, FolderItem *item, MsgInfo *msginfo)
705 if (stat(itos(msginfo->msgnum), &s) < 0 ||
706 msginfo->size != s.st_size ||
707 msginfo->mtime != s.st_mtime)
713 gint mh_scan_folder(Folder *folder, FolderItem *item)
722 g_return_val_if_fail(item != NULL, -1);
724 debug_print("mh_scan_folder(): Scanning %s ...\n", item->path);
726 path = folder_item_get_path(item);
727 g_return_val_if_fail(path != NULL, -1);
728 if (change_dir(path) < 0) {
734 if ((dp = opendir(".")) == NULL) {
735 FILE_OP_ERROR(item->path, "opendir");
740 folder->ui_func(folder, item, folder->ui_func_data);
742 while ((d = readdir(dp)) != NULL) {
743 if ((num = to_number(d->d_name)) >= 0 &&
744 stat(d->d_name, &s) == 0 &&
745 S_ISREG(s.st_mode)) {
757 item->new = item->unread = item->total = 0;
759 gint new, unread, total, min, max;
761 procmsg_get_mark_sum(".", &new, &unread, &total, &min, &max, 0);
763 new += n_msg - total;
764 unread += n_msg - total;
767 item->unread = unread;
771 debug_print("Last number in dir %s = %d\n", item->path, max);
772 item->last_num = max;
777 void mh_scan_tree(Folder *folder)
782 g_return_if_fail(folder != NULL);
784 item = folder_item_new(folder, folder->name, NULL);
785 item->folder = folder;
786 folder->node = g_node_new(item);
788 rootpath = folder_item_get_path(item);
789 if (change_dir(rootpath) < 0) {
795 mh_create_tree(folder);
796 mh_scan_tree_recursive(item);
799 #define MAKE_DIR_IF_NOT_EXIST(dir) \
801 if (!is_dir_exist(dir)) { \
802 if (is_file_exist(dir)) { \
803 g_warning("File `%s' already exists.\n" \
804 "Can't create folder.", dir); \
807 if (make_dir(dir) < 0) \
812 gint mh_create_tree(Folder *folder)
816 g_return_val_if_fail(folder != NULL, -1);
818 CHDIR_RETURN_VAL_IF_FAIL(get_home_dir(), -1);
819 rootpath = LOCAL_FOLDER(folder)->rootpath;
820 MAKE_DIR_IF_NOT_EXIST(rootpath);
821 CHDIR_RETURN_VAL_IF_FAIL(rootpath, -1);
822 MAKE_DIR_IF_NOT_EXIST(INBOX_DIR);
823 MAKE_DIR_IF_NOT_EXIST(OUTBOX_DIR);
824 MAKE_DIR_IF_NOT_EXIST(QUEUE_DIR);
825 MAKE_DIR_IF_NOT_EXIST(DRAFT_DIR);
826 MAKE_DIR_IF_NOT_EXIST(TRASH_DIR);
831 #undef MAKE_DIR_IF_NOT_EXIST
833 FolderItem *mh_create_folder(Folder *folder, FolderItem *parent,
838 FolderItem *new_item;
839 gchar *mh_sequences_filename;
840 FILE *mh_sequences_file;
842 g_return_val_if_fail(folder != NULL, NULL);
843 g_return_val_if_fail(parent != NULL, NULL);
844 g_return_val_if_fail(name != NULL, NULL);
846 path = folder_item_get_path(parent);
847 if (!is_dir_exist(path))
848 if (make_dir_hier(path) != 0)
851 fullpath = g_strconcat(path, G_DIR_SEPARATOR_S, name, NULL);
854 if (make_dir(fullpath) < 0) {
862 path = g_strconcat(parent->path, G_DIR_SEPARATOR_S, name,
865 path = g_strdup(name);
866 new_item = folder_item_new(folder, name, path);
867 folder_item_append(parent, new_item);
871 path = folder_item_get_path(new_item);
872 mh_sequences_filename = g_strconcat(path, G_DIR_SEPARATOR_S,
873 ".mh_sequences", NULL);
874 if ((mh_sequences_file = fopen(mh_sequences_filename, "a+b")) != NULL) {
875 fclose(mh_sequences_file);
877 g_free(mh_sequences_filename);
883 gint mh_rename_folder(Folder *folder, FolderItem *item, const gchar *name)
891 g_return_val_if_fail(folder != NULL, -1);
892 g_return_val_if_fail(item != NULL, -1);
893 g_return_val_if_fail(item->path != NULL, -1);
894 g_return_val_if_fail(name != NULL, -1);
896 oldpath = folder_item_get_path(item);
897 if (!is_dir_exist(oldpath))
898 make_dir_hier(oldpath);
900 dirname = g_dirname(oldpath);
901 newpath = g_strconcat(dirname, G_DIR_SEPARATOR_S, name, NULL);
904 if (rename(oldpath, newpath) < 0) {
905 FILE_OP_ERROR(oldpath, "rename");
914 if (strchr(item->path, G_DIR_SEPARATOR) != NULL) {
915 dirname = g_dirname(item->path);
916 newpath = g_strconcat(dirname, G_DIR_SEPARATOR_S, name, NULL);
919 newpath = g_strdup(name);
922 item->name = g_strdup(name);
924 node = g_node_find(item->folder->node, G_PRE_ORDER, G_TRAVERSE_ALL,
926 paths[0] = g_strdup(item->path);
928 g_node_traverse(node, G_PRE_ORDER, G_TRAVERSE_ALL, -1,
929 mh_rename_folder_func, paths);
936 gint mh_remove_folder(Folder *folder, FolderItem *item)
940 g_return_val_if_fail(folder != NULL, -1);
941 g_return_val_if_fail(item != NULL, -1);
942 g_return_val_if_fail(item->path != NULL, -1);
944 path = folder_item_get_path(item);
945 if (remove_dir_recursive(path) < 0) {
946 g_warning("can't remove directory `%s'\n", path);
952 folder_item_remove(item);
956 static MsgInfo *mh_parse_msg(const gchar *file, FolderItem *item)
962 flags.perm_flags = MSG_NEW|MSG_UNREAD;
965 g_return_val_if_fail(item != NULL, NULL);
966 g_return_val_if_fail(file != NULL, NULL);
968 if (item->stype == F_QUEUE) {
969 MSG_SET_TMP_FLAGS(flags, MSG_QUEUED);
970 } else if (item->stype == F_DRAFT) {
971 MSG_SET_TMP_FLAGS(flags, MSG_DRAFT);
974 msginfo = procheader_parse_file(file, flags, FALSE, FALSE);
975 if (!msginfo) return NULL;
977 msginfo->msgnum = atoi(file);
978 msginfo->folder = item;
980 if (stat(file, &s) < 0) {
981 FILE_OP_ERROR(file, "stat");
985 msginfo->size = s.st_size;
986 msginfo->mtime = s.st_mtime;
993 static gboolean mh_is_maildir_one(const gchar *path, const gchar *dir)
998 entry = g_strconcat(path, G_DIR_SEPARATOR_S, dir, NULL);
999 result = is_dir_exist(entry);
1006 * check whether PATH is a Maildir style mailbox.
1007 * This is the case if the 3 subdir: new, cur, tmp are existing.
1008 * This functon assumes that entry is an directory
1010 static gboolean mh_is_maildir(const gchar *path)
1012 return mh_is_maildir_one(path, "new") &&
1013 mh_is_maildir_one(path, "cur") &&
1014 mh_is_maildir_one(path, "tmp");
1018 static void mh_scan_tree_recursive(FolderItem *item)
1026 g_return_if_fail(item != NULL);
1027 g_return_if_fail(item->folder != NULL);
1029 dp = opendir(item->path ? item->path : ".");
1031 FILE_OP_ERROR(item->path ? item->path : ".", "opendir");
1035 debug_print("scanning %s ...\n",
1036 item->path ? item->path
1037 : LOCAL_FOLDER(item->folder)->rootpath);
1038 if (item->folder->ui_func)
1039 item->folder->ui_func(item->folder, item,
1040 item->folder->ui_func_data);
1042 while ((d = readdir(dp)) != NULL) {
1043 if (d->d_name[0] == '.') continue;
1046 entry = g_strconcat(item->path, G_DIR_SEPARATOR_S,
1049 entry = g_strdup(d->d_name);
1051 if (stat(entry, &s) < 0) {
1052 FILE_OP_ERROR(entry, "stat");
1057 if (S_ISDIR(s.st_mode)) {
1058 FolderItem *new_item;
1061 if (mh_is_maildir(entry)) {
1067 new_item = folder_item_new(item->folder, d->d_name, entry);
1068 folder_item_append(item, new_item);
1070 if (!strcmp(d->d_name, INBOX_DIR)) {
1071 new_item->stype = F_INBOX;
1072 item->folder->inbox = new_item;
1073 } else if (!strcmp(d->d_name, OUTBOX_DIR)) {
1074 new_item->stype = F_OUTBOX;
1075 item->folder->outbox = new_item;
1076 } else if (!strcmp(d->d_name, DRAFT_DIR)) {
1077 new_item->stype = F_DRAFT;
1078 item->folder->draft = new_item;
1079 } else if (!strcmp(d->d_name, QUEUE_DIR)) {
1080 new_item->stype = F_QUEUE;
1081 item->folder->queue = new_item;
1082 } else if (!strcmp(d->d_name, TRASH_DIR)) {
1083 new_item->stype = F_TRASH;
1084 item->folder->trash = new_item;
1087 mh_scan_tree_recursive(new_item);
1088 } else if (to_number(d->d_name) != -1) n_msg++;
1097 gint new, unread, total, min, max;
1099 procmsg_get_mark_sum(item->path, &new, &unread, &total,
1101 if (n_msg > total) {
1102 new += n_msg - total;
1103 unread += n_msg - total;
1106 item->unread = unread;
1107 item->total = n_msg;
1112 static gboolean mh_rename_folder_func(GNode *node, gpointer data)
1114 FolderItem *item = node->data;
1115 gchar **paths = data;
1116 const gchar *oldpath = paths[0];
1117 const gchar *newpath = paths[1];
1119 gchar *new_itempath;
1122 oldpathlen = strlen(oldpath);
1123 if (strncmp(oldpath, item->path, oldpathlen) != 0) {
1124 g_warning("path doesn't match: %s, %s\n", oldpath, item->path);
1128 base = item->path + oldpathlen;
1129 while (*base == G_DIR_SEPARATOR) base++;
1131 new_itempath = g_strdup(newpath);
1133 new_itempath = g_strconcat(newpath, G_DIR_SEPARATOR_S, base,
1136 item->path = new_itempath;