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 =
117 /* Folder functions */
123 /* FolderItem functions */
135 /* Message functions */
141 mh_move_msgs_with_dest,
143 mh_copy_msgs_with_dest,
151 FolderClass *mh_get_class()
156 Folder *mh_folder_new(const gchar *name, const gchar *path)
160 folder = (Folder *)g_new0(MHFolder, 1);
161 folder->class = &mh_class;
162 mh_folder_init(folder, name, path);
167 void mh_folder_destroy(Folder *folder)
169 folder_local_folder_destroy(LOCAL_FOLDER(folder));
172 static void mh_folder_init(Folder *folder, const gchar *name, const gchar *path)
174 folder_local_folder_init(folder, name, path);
178 void mh_get_last_num(Folder *folder, FolderItem *item)
187 g_return_if_fail(item != NULL);
189 debug_print("mh_get_last_num(): Scanning %s ...\n", item->path);
191 path = folder_item_get_path(item);
192 g_return_if_fail(path != NULL);
193 if (change_dir(path) < 0) {
199 if ((dp = opendir(".")) == NULL) {
200 FILE_OP_ERROR(item->path, "opendir");
204 while ((d = readdir(dp)) != NULL) {
205 if ((num = to_number(d->d_name)) >= 0 &&
206 stat(d->d_name, &s) == 0 &&
207 S_ISREG(s.st_mode)) {
214 debug_print("Last number in dir %s = %d\n", item->path, max);
215 item->last_num = max;
218 gint mh_get_num_list(Folder *folder, FolderItem *item, GSList **list)
225 gint num, nummsgs = 0;
227 g_return_val_if_fail(item != NULL, -1);
229 debug_print("mh_get_last_num(): Scanning %s ...\n", item->path);
231 path = folder_item_get_path(item);
232 g_return_val_if_fail(path != NULL, -1);
233 if (change_dir(path) < 0) {
239 if ((dp = opendir(".")) == NULL) {
240 FILE_OP_ERROR(item->path, "opendir");
244 while ((d = readdir(dp)) != NULL) {
245 if ((num = to_number(d->d_name)) >= 0 &&
246 stat(d->d_name, &s) == 0 &&
247 S_ISREG(s.st_mode)) {
248 *list = g_slist_prepend(*list, GINT_TO_POINTER(num));
257 gchar *mh_fetch_msg(Folder *folder, FolderItem *item, gint num)
262 g_return_val_if_fail(item != NULL, NULL);
263 g_return_val_if_fail(num > 0, NULL);
265 path = folder_item_get_path(item);
266 file = g_strconcat(path, G_DIR_SEPARATOR_S, itos(num), NULL);
268 if (!is_file_exist(file)) {
276 MsgInfo *mh_get_msginfo(Folder *folder, FolderItem *item, gint num)
281 g_return_val_if_fail(item != NULL, NULL);
282 g_return_val_if_fail(num > 0, NULL);
284 file = mh_fetch_msg(folder, item, num);
285 if (!file) return NULL;
287 msginfo = mh_parse_msg(file, item);
289 msginfo->msgnum = num;
296 gchar *mh_get_new_msg_filename(FolderItem *dest)
301 destpath = folder_item_get_path(dest);
302 g_return_val_if_fail(destpath != NULL, NULL);
304 if (!is_dir_exist(destpath))
305 make_dir_hier(destpath);
308 destfile = g_strdup_printf("%s%c%d", destpath, G_DIR_SEPARATOR,
310 if (is_file_entry_exist(destfile)) {
322 #define SET_DEST_MSG_FLAGS(fp, dest, msginfo) \
324 MsgInfo newmsginfo; \
326 newmsginfo.msgnum = dest->last_num; \
327 newmsginfo.flags = msginfo->flags; \
328 if (dest->stype == F_OUTBOX || \
329 dest->stype == F_QUEUE || \
330 dest->stype == F_DRAFT || \
331 dest->stype == F_TRASH) \
332 MSG_UNSET_PERM_FLAGS(newmsginfo.flags, \
333 MSG_NEW|MSG_UNREAD|MSG_DELETED); \
335 procmsg_write_flags(&newmsginfo, fp); \
338 gint mh_add_msg(Folder *folder, FolderItem *dest, const gchar *file,
339 gboolean remove_source)
343 g_return_val_if_fail(dest != NULL, -1);
344 g_return_val_if_fail(file != NULL, -1);
346 if (dest->last_num < 0) {
347 mh_get_last_num(folder, dest);
348 if (dest->last_num < 0) return -1;
351 destfile = mh_get_new_msg_filename(dest);
352 g_return_val_if_fail(destfile != NULL, -1);
354 if (link(file, destfile) < 0) {
355 if (copy_file(file, destfile, TRUE) < 0) {
356 g_warning("can't copy message %s to %s\n",
364 if (unlink(file) < 0)
365 FILE_OP_ERROR(file, "unlink");
370 return dest->last_num;
373 static gint mh_do_move(Folder *folder, FolderItem *dest, MsgInfo *msginfo)
378 PrefsFolderItem *prefs;
380 g_return_val_if_fail(dest != NULL, -1);
381 g_return_val_if_fail(msginfo != NULL, -1);
383 if (msginfo->folder == dest) {
384 g_warning("the src folder is identical to the dest.\n");
388 if (dest->last_num < 0) {
389 mh_get_last_num(folder, dest);
390 if (dest->last_num < 0) return -1;
395 destfile = mh_get_new_msg_filename(dest);
396 if (!destfile) return -1;
398 srcfile = procmsg_get_message_file(msginfo);
400 debug_print("Moving message %s%c%d to %s ...\n",
401 msginfo->folder->path, G_DIR_SEPARATOR,
402 msginfo->msgnum, dest->path);
404 if (move_file(srcfile, destfile, FALSE) < 0) {
410 if (prefs && prefs->enable_folder_chmod && prefs->folder_chmod) {
411 if (chmod(destfile, prefs->folder_chmod) < 0)
412 FILE_OP_ERROR(destfile, "chmod");
415 filemode = prefs->folder_chmod;
416 if (filemode & S_IRGRP) filemode |= S_IWGRP;
417 if (filemode & S_IROTH) filemode |= S_IWOTH;
424 return dest->last_num;
427 gint mh_move_msg(Folder *folder, FolderItem *dest, MsgInfo *msginfo)
432 g_return_val_if_fail(folder != NULL, -1);
433 g_return_val_if_fail(dest != NULL, -1);
434 g_return_val_if_fail(msginfo != NULL, -1);
435 g_return_val_if_fail(msginfo->folder != NULL, -1);
437 if (folder == msginfo->folder->folder)
438 return mh_do_move(folder, dest, msginfo);
440 srcfile = procmsg_get_message_file(msginfo);
441 if (!srcfile) return -1;
443 ret = mh_add_msg(folder, dest, srcfile, FALSE);
447 ret = folder_item_remove_msg(msginfo->folder, msginfo->msgnum);
452 static gint mh_do_move_msgs_with_dest(Folder *folder, FolderItem *dest,
459 PrefsFolderItem *prefs;
461 g_return_val_if_fail(dest != NULL, -1);
462 g_return_val_if_fail(msglist != NULL, -1);
464 if (dest->last_num < 0) {
465 mh_get_last_num(folder, dest);
466 if (dest->last_num < 0) return -1;
471 for (cur = msglist; cur != NULL; cur = cur->next) {
472 msginfo = (MsgInfo *)cur->data;
474 if (msginfo->folder == dest) {
475 g_warning("the src folder is identical to the dest.\n");
478 debug_print("Moving message %s%c%d to %s ...\n",
479 msginfo->folder->path, G_DIR_SEPARATOR,
480 msginfo->msgnum, dest->path);
482 destfile = mh_get_new_msg_filename(dest);
483 if (!destfile) return -1;
484 srcfile = procmsg_get_message_file(msginfo);
486 if (move_file(srcfile, destfile, FALSE) < 0) {
497 return dest->last_num;
500 gint mh_move_msgs_with_dest(Folder *folder, FolderItem *dest, GSList *msglist)
506 msginfo = (MsgInfo *)msglist->data;
507 if (folder == msginfo->folder->folder)
508 return mh_do_move_msgs_with_dest(folder, dest, msglist);
510 for (cur = msglist; cur != NULL; cur = cur->next) {
511 msginfo = (MsgInfo *)cur->data;
512 ret = mh_move_msg(folder, dest, msginfo);
513 if (ret == -1) break;
519 gint mh_copy_msg(Folder *folder, FolderItem *dest, MsgInfo *msginfo)
524 PrefsFolderItem *prefs;
526 g_return_val_if_fail(dest != NULL, -1);
527 g_return_val_if_fail(msginfo != NULL, -1);
529 if (msginfo->folder == dest) {
530 g_warning("the src folder is identical to the dest.\n");
534 if (dest->last_num < 0) {
535 mh_get_last_num(folder, dest);
536 if (dest->last_num < 0) return -1;
541 srcfile = procmsg_get_message_file(msginfo);
542 destfile = mh_get_new_msg_filename(dest);
548 debug_print("Copying message %s%c%d to %s ...\n",
549 msginfo->folder->path, G_DIR_SEPARATOR,
550 msginfo->msgnum, dest->path);
553 if ((MSG_IS_QUEUED(msginfo->flags) || MSG_IS_DRAFT(msginfo->flags))
554 && dest->stype != F_QUEUE && dest->stype != F_DRAFT) {
555 if (procmsg_remove_special_headers(srcfile, destfile) !=0) {
560 } else if (copy_file(srcfile, destfile, TRUE) < 0) {
561 FILE_OP_ERROR(srcfile, "copy");
568 if (prefs && prefs->enable_folder_chmod && prefs->folder_chmod) {
569 if (chmod(destfile, prefs->folder_chmod) < 0)
570 FILE_OP_ERROR(destfile, "chmod");
573 filemode = prefs->folder_chmod;
574 if (filemode & S_IRGRP) filemode |= S_IWGRP;
575 if (filemode & S_IROTH) filemode |= S_IWOTH;
582 return dest->last_num;
586 gint mh_copy_msg(Folder *folder, FolderItem *dest, MsgInfo *msginfo)
594 src_folder = msginfo->folder->folder;
596 g_return_val_if_fail(src_folder->fetch_msg != NULL, -1);
598 filename = src_folder->fetch_msg(src_folder,
601 if (filename == NULL)
604 num = folder->add_msg(folder, dest, filename, FALSE);
606 destdir = folder_item_get_path(dest);
611 newmsginfo.msgnum = dest->last_num;
612 newmsginfo.flags = msginfo->flags;
613 if (dest->stype == F_OUTBOX ||
614 dest->stype == F_QUEUE ||
615 dest->stype == F_DRAFT ||
616 dest->stype == F_TRASH)
617 MSG_UNSET_FLAGS(newmsginfo.flags,
618 MSG_NEW|MSG_UNREAD|MSG_DELETED);
620 procmsg_write_flags(&newmsginfo, fp);
628 gint mh_copy_msgs_with_dest(Folder *folder, FolderItem *dest, GSList *msglist)
635 g_return_val_if_fail(dest != NULL, -1);
636 g_return_val_if_fail(msglist != NULL, -1);
638 if (dest->last_num < 0) {
639 mh_get_last_num(folder, dest);
640 if (dest->last_num < 0) return -1;
643 for (cur = msglist; cur != NULL; cur = cur->next) {
644 msginfo = (MsgInfo *)cur->data;
646 if (msginfo->folder == dest) {
647 g_warning("the src folder is identical to the dest.\n");
650 debug_print("Copying message %s%c%d to %s ...\n",
651 msginfo->folder->path, G_DIR_SEPARATOR,
652 msginfo->msgnum, dest->path);
654 destfile = mh_get_new_msg_filename(dest);
655 if (!destfile) break;
656 srcfile = procmsg_get_message_file(msginfo);
658 if (copy_file(srcfile, destfile, TRUE) < 0) {
659 FILE_OP_ERROR(srcfile, "copy");
670 return dest->last_num;
673 gint mh_remove_msg(Folder *folder, FolderItem *item, gint num)
677 g_return_val_if_fail(item != NULL, -1);
679 file = mh_fetch_msg(folder, item, num);
680 g_return_val_if_fail(file != NULL, -1);
682 if (unlink(file) < 0) {
683 FILE_OP_ERROR(file, "unlink");
692 gint mh_remove_all_msg(Folder *folder, FolderItem *item)
697 g_return_val_if_fail(item != NULL, -1);
699 path = folder_item_get_path(item);
700 g_return_val_if_fail(path != NULL, -1);
701 val = remove_all_numbered_files(path);
707 gboolean mh_is_msg_changed(Folder *folder, FolderItem *item, MsgInfo *msginfo)
711 if (stat(itos(msginfo->msgnum), &s) < 0 ||
712 msginfo->size != s.st_size ||
713 msginfo->mtime != s.st_mtime)
719 gint mh_scan_folder(Folder *folder, FolderItem *item)
728 g_return_val_if_fail(item != NULL, -1);
730 debug_print("mh_scan_folder(): Scanning %s ...\n", item->path);
732 path = folder_item_get_path(item);
733 g_return_val_if_fail(path != NULL, -1);
734 if (change_dir(path) < 0) {
740 if ((dp = opendir(".")) == NULL) {
741 FILE_OP_ERROR(item->path, "opendir");
746 folder->ui_func(folder, item, folder->ui_func_data);
748 while ((d = readdir(dp)) != NULL) {
749 if ((num = to_number(d->d_name)) >= 0 &&
750 stat(d->d_name, &s) == 0 &&
751 S_ISREG(s.st_mode)) {
763 item->new = item->unread = item->total = 0;
765 gint new, unread, total, min, max;
767 procmsg_get_mark_sum(".", &new, &unread, &total, &min, &max, 0);
769 new += n_msg - total;
770 unread += n_msg - total;
773 item->unread = unread;
777 debug_print("Last number in dir %s = %d\n", item->path, max);
778 item->last_num = max;
783 void mh_scan_tree(Folder *folder)
788 g_return_if_fail(folder != NULL);
790 item = folder_item_new(folder, folder->name, NULL);
791 item->folder = folder;
792 folder->node = g_node_new(item);
794 rootpath = folder_item_get_path(item);
795 if (change_dir(rootpath) < 0) {
801 mh_create_tree(folder);
802 mh_scan_tree_recursive(item);
805 #define MAKE_DIR_IF_NOT_EXIST(dir) \
807 if (!is_dir_exist(dir)) { \
808 if (is_file_exist(dir)) { \
809 g_warning("File `%s' already exists.\n" \
810 "Can't create folder.", dir); \
813 if (make_dir(dir) < 0) \
818 gint mh_create_tree(Folder *folder)
822 g_return_val_if_fail(folder != NULL, -1);
824 CHDIR_RETURN_VAL_IF_FAIL(get_home_dir(), -1);
825 rootpath = LOCAL_FOLDER(folder)->rootpath;
826 MAKE_DIR_IF_NOT_EXIST(rootpath);
827 CHDIR_RETURN_VAL_IF_FAIL(rootpath, -1);
828 MAKE_DIR_IF_NOT_EXIST(INBOX_DIR);
829 MAKE_DIR_IF_NOT_EXIST(OUTBOX_DIR);
830 MAKE_DIR_IF_NOT_EXIST(QUEUE_DIR);
831 MAKE_DIR_IF_NOT_EXIST(DRAFT_DIR);
832 MAKE_DIR_IF_NOT_EXIST(TRASH_DIR);
837 #undef MAKE_DIR_IF_NOT_EXIST
839 FolderItem *mh_create_folder(Folder *folder, FolderItem *parent,
844 FolderItem *new_item;
845 gchar *mh_sequences_filename;
846 FILE *mh_sequences_file;
848 g_return_val_if_fail(folder != NULL, NULL);
849 g_return_val_if_fail(parent != NULL, NULL);
850 g_return_val_if_fail(name != NULL, NULL);
852 path = folder_item_get_path(parent);
853 if (!is_dir_exist(path))
854 if (make_dir_hier(path) != 0)
857 fullpath = g_strconcat(path, G_DIR_SEPARATOR_S, name, NULL);
860 if (make_dir(fullpath) < 0) {
868 path = g_strconcat(parent->path, G_DIR_SEPARATOR_S, name,
871 path = g_strdup(name);
872 new_item = folder_item_new(folder, name, path);
873 folder_item_append(parent, new_item);
877 path = folder_item_get_path(new_item);
878 mh_sequences_filename = g_strconcat(path, G_DIR_SEPARATOR_S,
879 ".mh_sequences", NULL);
880 if ((mh_sequences_file = fopen(mh_sequences_filename, "a+b")) != NULL) {
881 fclose(mh_sequences_file);
883 g_free(mh_sequences_filename);
889 gint mh_rename_folder(Folder *folder, FolderItem *item, const gchar *name)
897 g_return_val_if_fail(folder != NULL, -1);
898 g_return_val_if_fail(item != NULL, -1);
899 g_return_val_if_fail(item->path != NULL, -1);
900 g_return_val_if_fail(name != NULL, -1);
902 oldpath = folder_item_get_path(item);
903 if (!is_dir_exist(oldpath))
904 make_dir_hier(oldpath);
906 dirname = g_dirname(oldpath);
907 newpath = g_strconcat(dirname, G_DIR_SEPARATOR_S, name, NULL);
910 if (rename(oldpath, newpath) < 0) {
911 FILE_OP_ERROR(oldpath, "rename");
920 if (strchr(item->path, G_DIR_SEPARATOR) != NULL) {
921 dirname = g_dirname(item->path);
922 newpath = g_strconcat(dirname, G_DIR_SEPARATOR_S, name, NULL);
925 newpath = g_strdup(name);
928 item->name = g_strdup(name);
930 node = g_node_find(item->folder->node, G_PRE_ORDER, G_TRAVERSE_ALL,
932 paths[0] = g_strdup(item->path);
934 g_node_traverse(node, G_PRE_ORDER, G_TRAVERSE_ALL, -1,
935 mh_rename_folder_func, paths);
942 gint mh_remove_folder(Folder *folder, FolderItem *item)
946 g_return_val_if_fail(folder != NULL, -1);
947 g_return_val_if_fail(item != NULL, -1);
948 g_return_val_if_fail(item->path != NULL, -1);
950 path = folder_item_get_path(item);
951 if (remove_dir_recursive(path) < 0) {
952 g_warning("can't remove directory `%s'\n", path);
958 folder_item_remove(item);
962 static MsgInfo *mh_parse_msg(const gchar *file, FolderItem *item)
968 flags.perm_flags = MSG_NEW|MSG_UNREAD;
971 g_return_val_if_fail(item != NULL, NULL);
972 g_return_val_if_fail(file != NULL, NULL);
974 if (item->stype == F_QUEUE) {
975 MSG_SET_TMP_FLAGS(flags, MSG_QUEUED);
976 } else if (item->stype == F_DRAFT) {
977 MSG_SET_TMP_FLAGS(flags, MSG_DRAFT);
980 msginfo = procheader_parse_file(file, flags, FALSE, FALSE);
981 if (!msginfo) return NULL;
983 msginfo->msgnum = atoi(file);
984 msginfo->folder = item;
986 if (stat(file, &s) < 0) {
987 FILE_OP_ERROR(file, "stat");
991 msginfo->size = s.st_size;
992 msginfo->mtime = s.st_mtime;
999 static gboolean mh_is_maildir_one(const gchar *path, const gchar *dir)
1004 entry = g_strconcat(path, G_DIR_SEPARATOR_S, dir, NULL);
1005 result = is_dir_exist(entry);
1012 * check whether PATH is a Maildir style mailbox.
1013 * This is the case if the 3 subdir: new, cur, tmp are existing.
1014 * This functon assumes that entry is an directory
1016 static gboolean mh_is_maildir(const gchar *path)
1018 return mh_is_maildir_one(path, "new") &&
1019 mh_is_maildir_one(path, "cur") &&
1020 mh_is_maildir_one(path, "tmp");
1024 static void mh_scan_tree_recursive(FolderItem *item)
1032 g_return_if_fail(item != NULL);
1033 g_return_if_fail(item->folder != NULL);
1035 dp = opendir(item->path ? item->path : ".");
1037 FILE_OP_ERROR(item->path ? item->path : ".", "opendir");
1041 debug_print("scanning %s ...\n",
1042 item->path ? item->path
1043 : LOCAL_FOLDER(item->folder)->rootpath);
1044 if (item->folder->ui_func)
1045 item->folder->ui_func(item->folder, item,
1046 item->folder->ui_func_data);
1048 while ((d = readdir(dp)) != NULL) {
1049 if (d->d_name[0] == '.') continue;
1052 entry = g_strconcat(item->path, G_DIR_SEPARATOR_S,
1055 entry = g_strdup(d->d_name);
1057 if (stat(entry, &s) < 0) {
1058 FILE_OP_ERROR(entry, "stat");
1063 if (S_ISDIR(s.st_mode)) {
1064 FolderItem *new_item;
1067 if (mh_is_maildir(entry)) {
1073 new_item = folder_item_new(item->folder, d->d_name, entry);
1074 folder_item_append(item, new_item);
1076 if (!strcmp(d->d_name, INBOX_DIR)) {
1077 new_item->stype = F_INBOX;
1078 item->folder->inbox = new_item;
1079 } else if (!strcmp(d->d_name, OUTBOX_DIR)) {
1080 new_item->stype = F_OUTBOX;
1081 item->folder->outbox = new_item;
1082 } else if (!strcmp(d->d_name, DRAFT_DIR)) {
1083 new_item->stype = F_DRAFT;
1084 item->folder->draft = new_item;
1085 } else if (!strcmp(d->d_name, QUEUE_DIR)) {
1086 new_item->stype = F_QUEUE;
1087 item->folder->queue = new_item;
1088 } else if (!strcmp(d->d_name, TRASH_DIR)) {
1089 new_item->stype = F_TRASH;
1090 item->folder->trash = new_item;
1093 mh_scan_tree_recursive(new_item);
1094 } else if (to_number(d->d_name) != -1) n_msg++;
1103 gint new, unread, total, min, max;
1105 procmsg_get_mark_sum(item->path, &new, &unread, &total,
1107 if (n_msg > total) {
1108 new += n_msg - total;
1109 unread += n_msg - total;
1112 item->unread = unread;
1113 item->total = n_msg;
1118 static gboolean mh_rename_folder_func(GNode *node, gpointer data)
1120 FolderItem *item = node->data;
1121 gchar **paths = data;
1122 const gchar *oldpath = paths[0];
1123 const gchar *newpath = paths[1];
1125 gchar *new_itempath;
1128 oldpathlen = strlen(oldpath);
1129 if (strncmp(oldpath, item->path, oldpathlen) != 0) {
1130 g_warning("path doesn't match: %s, %s\n", oldpath, item->path);
1134 base = item->path + oldpathlen;
1135 while (*base == G_DIR_SEPARATOR) base++;
1137 new_itempath = g_strdup(newpath);
1139 new_itempath = g_strconcat(newpath, G_DIR_SEPARATOR_S, base,
1142 item->path = new_itempath;