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 =
116 /* Folder functions */
122 /* FolderItem functions */
134 /* Message functions */
140 mh_move_msgs_with_dest,
142 mh_copy_msgs_with_dest,
150 FolderClass *mh_get_class()
155 Folder *mh_folder_new(const gchar *name, const gchar *path)
159 folder = (Folder *)g_new0(MHFolder, 1);
160 folder->class = &mh_class;
161 mh_folder_init(folder, name, path);
166 void mh_folder_destroy(Folder *folder)
168 folder_local_folder_destroy(LOCAL_FOLDER(folder));
171 static void mh_folder_init(Folder *folder, const gchar *name, const gchar *path)
173 folder_local_folder_init(folder, name, path);
177 void mh_get_last_num(Folder *folder, FolderItem *item)
186 g_return_if_fail(item != NULL);
188 debug_print("mh_get_last_num(): Scanning %s ...\n", item->path);
190 path = folder_item_get_path(item);
191 g_return_if_fail(path != NULL);
192 if (change_dir(path) < 0) {
198 if ((dp = opendir(".")) == NULL) {
199 FILE_OP_ERROR(item->path, "opendir");
203 while ((d = readdir(dp)) != NULL) {
204 if ((num = to_number(d->d_name)) >= 0 &&
205 stat(d->d_name, &s) == 0 &&
206 S_ISREG(s.st_mode)) {
213 debug_print("Last number in dir %s = %d\n", item->path, max);
214 item->last_num = max;
217 gint mh_get_num_list(Folder *folder, FolderItem *item, GSList **list)
224 gint num, nummsgs = 0;
226 g_return_val_if_fail(item != NULL, -1);
228 debug_print("mh_get_last_num(): Scanning %s ...\n", item->path);
230 path = folder_item_get_path(item);
231 g_return_val_if_fail(path != NULL, -1);
232 if (change_dir(path) < 0) {
238 if ((dp = opendir(".")) == NULL) {
239 FILE_OP_ERROR(item->path, "opendir");
243 while ((d = readdir(dp)) != NULL) {
244 if ((num = to_number(d->d_name)) >= 0 &&
245 stat(d->d_name, &s) == 0 &&
246 S_ISREG(s.st_mode)) {
247 *list = g_slist_prepend(*list, GINT_TO_POINTER(num));
256 gchar *mh_fetch_msg(Folder *folder, FolderItem *item, gint num)
261 g_return_val_if_fail(item != NULL, NULL);
262 g_return_val_if_fail(num > 0, NULL);
264 path = folder_item_get_path(item);
265 file = g_strconcat(path, G_DIR_SEPARATOR_S, itos(num), NULL);
267 if (!is_file_exist(file)) {
275 MsgInfo *mh_get_msginfo(Folder *folder, FolderItem *item, gint num)
280 g_return_val_if_fail(item != NULL, NULL);
281 g_return_val_if_fail(num > 0, NULL);
283 file = mh_fetch_msg(folder, item, num);
284 if (!file) return NULL;
286 msginfo = mh_parse_msg(file, item);
288 msginfo->msgnum = num;
295 gchar *mh_get_new_msg_filename(FolderItem *dest)
300 destpath = folder_item_get_path(dest);
301 g_return_val_if_fail(destpath != NULL, NULL);
303 if (!is_dir_exist(destpath))
304 make_dir_hier(destpath);
307 destfile = g_strdup_printf("%s%c%d", destpath, G_DIR_SEPARATOR,
309 if (is_file_entry_exist(destfile)) {
321 #define SET_DEST_MSG_FLAGS(fp, dest, msginfo) \
323 MsgInfo newmsginfo; \
325 newmsginfo.msgnum = dest->last_num; \
326 newmsginfo.flags = msginfo->flags; \
327 if (dest->stype == F_OUTBOX || \
328 dest->stype == F_QUEUE || \
329 dest->stype == F_DRAFT || \
330 dest->stype == F_TRASH) \
331 MSG_UNSET_PERM_FLAGS(newmsginfo.flags, \
332 MSG_NEW|MSG_UNREAD|MSG_DELETED); \
334 procmsg_write_flags(&newmsginfo, fp); \
337 gint mh_add_msg(Folder *folder, FolderItem *dest, const gchar *file,
338 gboolean remove_source)
342 g_return_val_if_fail(dest != NULL, -1);
343 g_return_val_if_fail(file != NULL, -1);
345 if (dest->last_num < 0) {
346 mh_get_last_num(folder, dest);
347 if (dest->last_num < 0) return -1;
350 destfile = mh_get_new_msg_filename(dest);
351 g_return_val_if_fail(destfile != NULL, -1);
353 if (link(file, destfile) < 0) {
354 if (copy_file(file, destfile, TRUE) < 0) {
355 g_warning("can't copy message %s to %s\n",
363 if (unlink(file) < 0)
364 FILE_OP_ERROR(file, "unlink");
369 return dest->last_num;
372 static gint mh_do_move(Folder *folder, FolderItem *dest, MsgInfo *msginfo)
377 PrefsFolderItem *prefs;
379 g_return_val_if_fail(dest != NULL, -1);
380 g_return_val_if_fail(msginfo != NULL, -1);
382 if (msginfo->folder == dest) {
383 g_warning("the src folder is identical to the dest.\n");
387 if (dest->last_num < 0) {
388 mh_get_last_num(folder, dest);
389 if (dest->last_num < 0) return -1;
394 destfile = mh_get_new_msg_filename(dest);
395 if (!destfile) return -1;
397 srcfile = procmsg_get_message_file(msginfo);
399 debug_print("Moving message %s%c%d to %s ...\n",
400 msginfo->folder->path, G_DIR_SEPARATOR,
401 msginfo->msgnum, dest->path);
403 if (move_file(srcfile, destfile, FALSE) < 0) {
409 if (prefs && prefs->enable_folder_chmod && prefs->folder_chmod) {
410 if (chmod(destfile, prefs->folder_chmod) < 0)
411 FILE_OP_ERROR(destfile, "chmod");
414 filemode = prefs->folder_chmod;
415 if (filemode & S_IRGRP) filemode |= S_IWGRP;
416 if (filemode & S_IROTH) filemode |= S_IWOTH;
423 return dest->last_num;
426 gint mh_move_msg(Folder *folder, FolderItem *dest, MsgInfo *msginfo)
431 g_return_val_if_fail(folder != NULL, -1);
432 g_return_val_if_fail(dest != NULL, -1);
433 g_return_val_if_fail(msginfo != NULL, -1);
434 g_return_val_if_fail(msginfo->folder != NULL, -1);
436 if (folder == msginfo->folder->folder)
437 return mh_do_move(folder, dest, msginfo);
439 srcfile = procmsg_get_message_file(msginfo);
440 if (!srcfile) return -1;
442 ret = mh_add_msg(folder, dest, srcfile, FALSE);
446 ret = folder_item_remove_msg(msginfo->folder, msginfo->msgnum);
451 static gint mh_do_move_msgs_with_dest(Folder *folder, FolderItem *dest,
458 PrefsFolderItem *prefs;
460 g_return_val_if_fail(dest != NULL, -1);
461 g_return_val_if_fail(msglist != NULL, -1);
463 if (dest->last_num < 0) {
464 mh_get_last_num(folder, dest);
465 if (dest->last_num < 0) return -1;
470 for (cur = msglist; cur != NULL; cur = cur->next) {
471 msginfo = (MsgInfo *)cur->data;
473 if (msginfo->folder == dest) {
474 g_warning("the src folder is identical to the dest.\n");
477 debug_print("Moving message %s%c%d to %s ...\n",
478 msginfo->folder->path, G_DIR_SEPARATOR,
479 msginfo->msgnum, dest->path);
481 destfile = mh_get_new_msg_filename(dest);
482 if (!destfile) return -1;
483 srcfile = procmsg_get_message_file(msginfo);
485 if (move_file(srcfile, destfile, FALSE) < 0) {
496 return dest->last_num;
499 gint mh_move_msgs_with_dest(Folder *folder, FolderItem *dest, GSList *msglist)
505 msginfo = (MsgInfo *)msglist->data;
506 if (folder == msginfo->folder->folder)
507 return mh_do_move_msgs_with_dest(folder, dest, msglist);
509 for (cur = msglist; cur != NULL; cur = cur->next) {
510 msginfo = (MsgInfo *)cur->data;
511 ret = mh_move_msg(folder, dest, msginfo);
512 if (ret == -1) break;
518 gint mh_copy_msg(Folder *folder, FolderItem *dest, MsgInfo *msginfo)
523 PrefsFolderItem *prefs;
525 g_return_val_if_fail(dest != NULL, -1);
526 g_return_val_if_fail(msginfo != NULL, -1);
528 if (msginfo->folder == dest) {
529 g_warning("the src folder is identical to the dest.\n");
533 if (dest->last_num < 0) {
534 mh_get_last_num(folder, dest);
535 if (dest->last_num < 0) return -1;
540 srcfile = procmsg_get_message_file(msginfo);
541 destfile = mh_get_new_msg_filename(dest);
547 debug_print("Copying message %s%c%d to %s ...\n",
548 msginfo->folder->path, G_DIR_SEPARATOR,
549 msginfo->msgnum, dest->path);
552 if ((MSG_IS_QUEUED(msginfo->flags) || MSG_IS_DRAFT(msginfo->flags))
553 && dest->stype != F_QUEUE && dest->stype != F_DRAFT) {
554 if (procmsg_remove_special_headers(srcfile, destfile) !=0) {
559 } else if (copy_file(srcfile, destfile, TRUE) < 0) {
560 FILE_OP_ERROR(srcfile, "copy");
567 if (prefs && prefs->enable_folder_chmod && prefs->folder_chmod) {
568 if (chmod(destfile, prefs->folder_chmod) < 0)
569 FILE_OP_ERROR(destfile, "chmod");
572 filemode = prefs->folder_chmod;
573 if (filemode & S_IRGRP) filemode |= S_IWGRP;
574 if (filemode & S_IROTH) filemode |= S_IWOTH;
581 return dest->last_num;
585 gint mh_copy_msg(Folder *folder, FolderItem *dest, MsgInfo *msginfo)
593 src_folder = msginfo->folder->folder;
595 g_return_val_if_fail(src_folder->fetch_msg != NULL, -1);
597 filename = src_folder->fetch_msg(src_folder,
600 if (filename == NULL)
603 num = folder->add_msg(folder, dest, filename, FALSE);
605 destdir = folder_item_get_path(dest);
610 newmsginfo.msgnum = dest->last_num;
611 newmsginfo.flags = msginfo->flags;
612 if (dest->stype == F_OUTBOX ||
613 dest->stype == F_QUEUE ||
614 dest->stype == F_DRAFT ||
615 dest->stype == F_TRASH)
616 MSG_UNSET_FLAGS(newmsginfo.flags,
617 MSG_NEW|MSG_UNREAD|MSG_DELETED);
619 procmsg_write_flags(&newmsginfo, fp);
627 gint mh_copy_msgs_with_dest(Folder *folder, FolderItem *dest, GSList *msglist)
634 g_return_val_if_fail(dest != NULL, -1);
635 g_return_val_if_fail(msglist != NULL, -1);
637 if (dest->last_num < 0) {
638 mh_get_last_num(folder, dest);
639 if (dest->last_num < 0) return -1;
642 for (cur = msglist; cur != NULL; cur = cur->next) {
643 msginfo = (MsgInfo *)cur->data;
645 if (msginfo->folder == dest) {
646 g_warning("the src folder is identical to the dest.\n");
649 debug_print("Copying message %s%c%d to %s ...\n",
650 msginfo->folder->path, G_DIR_SEPARATOR,
651 msginfo->msgnum, dest->path);
653 destfile = mh_get_new_msg_filename(dest);
654 if (!destfile) break;
655 srcfile = procmsg_get_message_file(msginfo);
657 if (copy_file(srcfile, destfile, TRUE) < 0) {
658 FILE_OP_ERROR(srcfile, "copy");
669 return dest->last_num;
672 gint mh_remove_msg(Folder *folder, FolderItem *item, gint num)
676 g_return_val_if_fail(item != NULL, -1);
678 file = mh_fetch_msg(folder, item, num);
679 g_return_val_if_fail(file != NULL, -1);
681 if (unlink(file) < 0) {
682 FILE_OP_ERROR(file, "unlink");
691 gint mh_remove_all_msg(Folder *folder, FolderItem *item)
696 g_return_val_if_fail(item != NULL, -1);
698 path = folder_item_get_path(item);
699 g_return_val_if_fail(path != NULL, -1);
700 val = remove_all_numbered_files(path);
706 gboolean mh_is_msg_changed(Folder *folder, FolderItem *item, MsgInfo *msginfo)
710 if (stat(itos(msginfo->msgnum), &s) < 0 ||
711 msginfo->size != s.st_size ||
712 msginfo->mtime != s.st_mtime)
718 gint mh_scan_folder(Folder *folder, FolderItem *item)
727 g_return_val_if_fail(item != NULL, -1);
729 debug_print("mh_scan_folder(): Scanning %s ...\n", item->path);
731 path = folder_item_get_path(item);
732 g_return_val_if_fail(path != NULL, -1);
733 if (change_dir(path) < 0) {
739 if ((dp = opendir(".")) == NULL) {
740 FILE_OP_ERROR(item->path, "opendir");
745 folder->ui_func(folder, item, folder->ui_func_data);
747 while ((d = readdir(dp)) != NULL) {
748 if ((num = to_number(d->d_name)) >= 0 &&
749 stat(d->d_name, &s) == 0 &&
750 S_ISREG(s.st_mode)) {
762 item->new = item->unread = item->total = 0;
764 gint new, unread, total, min, max;
766 procmsg_get_mark_sum(".", &new, &unread, &total, &min, &max, 0);
768 new += n_msg - total;
769 unread += n_msg - total;
772 item->unread = unread;
776 debug_print("Last number in dir %s = %d\n", item->path, max);
777 item->last_num = max;
782 void mh_scan_tree(Folder *folder)
787 g_return_if_fail(folder != NULL);
789 item = folder_item_new(folder, folder->name, NULL);
790 item->folder = folder;
791 folder->node = g_node_new(item);
793 rootpath = folder_item_get_path(item);
794 if (change_dir(rootpath) < 0) {
800 mh_create_tree(folder);
801 mh_scan_tree_recursive(item);
804 #define MAKE_DIR_IF_NOT_EXIST(dir) \
806 if (!is_dir_exist(dir)) { \
807 if (is_file_exist(dir)) { \
808 g_warning("File `%s' already exists.\n" \
809 "Can't create folder.", dir); \
812 if (make_dir(dir) < 0) \
817 gint mh_create_tree(Folder *folder)
821 g_return_val_if_fail(folder != NULL, -1);
823 CHDIR_RETURN_VAL_IF_FAIL(get_home_dir(), -1);
824 rootpath = LOCAL_FOLDER(folder)->rootpath;
825 MAKE_DIR_IF_NOT_EXIST(rootpath);
826 CHDIR_RETURN_VAL_IF_FAIL(rootpath, -1);
827 MAKE_DIR_IF_NOT_EXIST(INBOX_DIR);
828 MAKE_DIR_IF_NOT_EXIST(OUTBOX_DIR);
829 MAKE_DIR_IF_NOT_EXIST(QUEUE_DIR);
830 MAKE_DIR_IF_NOT_EXIST(DRAFT_DIR);
831 MAKE_DIR_IF_NOT_EXIST(TRASH_DIR);
836 #undef MAKE_DIR_IF_NOT_EXIST
838 FolderItem *mh_create_folder(Folder *folder, FolderItem *parent,
843 FolderItem *new_item;
844 gchar *mh_sequences_filename;
845 FILE *mh_sequences_file;
847 g_return_val_if_fail(folder != NULL, NULL);
848 g_return_val_if_fail(parent != NULL, NULL);
849 g_return_val_if_fail(name != NULL, NULL);
851 path = folder_item_get_path(parent);
852 if (!is_dir_exist(path))
853 if (make_dir_hier(path) != 0)
856 fullpath = g_strconcat(path, G_DIR_SEPARATOR_S, name, NULL);
859 if (make_dir(fullpath) < 0) {
867 path = g_strconcat(parent->path, G_DIR_SEPARATOR_S, name,
870 path = g_strdup(name);
871 new_item = folder_item_new(folder, name, path);
872 folder_item_append(parent, new_item);
876 path = folder_item_get_path(new_item);
877 mh_sequences_filename = g_strconcat(path, G_DIR_SEPARATOR_S,
878 ".mh_sequences", NULL);
879 if ((mh_sequences_file = fopen(mh_sequences_filename, "a+b")) != NULL) {
880 fclose(mh_sequences_file);
882 g_free(mh_sequences_filename);
888 gint mh_rename_folder(Folder *folder, FolderItem *item, const gchar *name)
896 g_return_val_if_fail(folder != NULL, -1);
897 g_return_val_if_fail(item != NULL, -1);
898 g_return_val_if_fail(item->path != NULL, -1);
899 g_return_val_if_fail(name != NULL, -1);
901 oldpath = folder_item_get_path(item);
902 if (!is_dir_exist(oldpath))
903 make_dir_hier(oldpath);
905 dirname = g_dirname(oldpath);
906 newpath = g_strconcat(dirname, G_DIR_SEPARATOR_S, name, NULL);
909 if (rename(oldpath, newpath) < 0) {
910 FILE_OP_ERROR(oldpath, "rename");
919 if (strchr(item->path, G_DIR_SEPARATOR) != NULL) {
920 dirname = g_dirname(item->path);
921 newpath = g_strconcat(dirname, G_DIR_SEPARATOR_S, name, NULL);
924 newpath = g_strdup(name);
927 item->name = g_strdup(name);
929 node = g_node_find(item->folder->node, G_PRE_ORDER, G_TRAVERSE_ALL,
931 paths[0] = g_strdup(item->path);
933 g_node_traverse(node, G_PRE_ORDER, G_TRAVERSE_ALL, -1,
934 mh_rename_folder_func, paths);
941 gint mh_remove_folder(Folder *folder, FolderItem *item)
945 g_return_val_if_fail(folder != NULL, -1);
946 g_return_val_if_fail(item != NULL, -1);
947 g_return_val_if_fail(item->path != NULL, -1);
949 path = folder_item_get_path(item);
950 if (remove_dir_recursive(path) < 0) {
951 g_warning("can't remove directory `%s'\n", path);
957 folder_item_remove(item);
961 static MsgInfo *mh_parse_msg(const gchar *file, FolderItem *item)
967 flags.perm_flags = MSG_NEW|MSG_UNREAD;
970 g_return_val_if_fail(item != NULL, NULL);
971 g_return_val_if_fail(file != NULL, NULL);
973 if (item->stype == F_QUEUE) {
974 MSG_SET_TMP_FLAGS(flags, MSG_QUEUED);
975 } else if (item->stype == F_DRAFT) {
976 MSG_SET_TMP_FLAGS(flags, MSG_DRAFT);
979 msginfo = procheader_parse_file(file, flags, FALSE, FALSE);
980 if (!msginfo) return NULL;
982 msginfo->msgnum = atoi(file);
983 msginfo->folder = item;
985 if (stat(file, &s) < 0) {
986 FILE_OP_ERROR(file, "stat");
990 msginfo->size = s.st_size;
991 msginfo->mtime = s.st_mtime;
998 static gboolean mh_is_maildir_one(const gchar *path, const gchar *dir)
1003 entry = g_strconcat(path, G_DIR_SEPARATOR_S, dir, NULL);
1004 result = is_dir_exist(entry);
1011 * check whether PATH is a Maildir style mailbox.
1012 * This is the case if the 3 subdir: new, cur, tmp are existing.
1013 * This functon assumes that entry is an directory
1015 static gboolean mh_is_maildir(const gchar *path)
1017 return mh_is_maildir_one(path, "new") &&
1018 mh_is_maildir_one(path, "cur") &&
1019 mh_is_maildir_one(path, "tmp");
1023 static void mh_scan_tree_recursive(FolderItem *item)
1031 g_return_if_fail(item != NULL);
1032 g_return_if_fail(item->folder != NULL);
1034 dp = opendir(item->path ? item->path : ".");
1036 FILE_OP_ERROR(item->path ? item->path : ".", "opendir");
1040 debug_print("scanning %s ...\n",
1041 item->path ? item->path
1042 : LOCAL_FOLDER(item->folder)->rootpath);
1043 if (item->folder->ui_func)
1044 item->folder->ui_func(item->folder, item,
1045 item->folder->ui_func_data);
1047 while ((d = readdir(dp)) != NULL) {
1048 if (d->d_name[0] == '.') continue;
1051 entry = g_strconcat(item->path, G_DIR_SEPARATOR_S,
1054 entry = g_strdup(d->d_name);
1056 if (stat(entry, &s) < 0) {
1057 FILE_OP_ERROR(entry, "stat");
1062 if (S_ISDIR(s.st_mode)) {
1063 FolderItem *new_item;
1066 if (mh_is_maildir(entry)) {
1072 new_item = folder_item_new(item->folder, d->d_name, entry);
1073 folder_item_append(item, new_item);
1075 if (!strcmp(d->d_name, INBOX_DIR)) {
1076 new_item->stype = F_INBOX;
1077 item->folder->inbox = new_item;
1078 } else if (!strcmp(d->d_name, OUTBOX_DIR)) {
1079 new_item->stype = F_OUTBOX;
1080 item->folder->outbox = new_item;
1081 } else if (!strcmp(d->d_name, DRAFT_DIR)) {
1082 new_item->stype = F_DRAFT;
1083 item->folder->draft = new_item;
1084 } else if (!strcmp(d->d_name, QUEUE_DIR)) {
1085 new_item->stype = F_QUEUE;
1086 item->folder->queue = new_item;
1087 } else if (!strcmp(d->d_name, TRASH_DIR)) {
1088 new_item->stype = F_TRASH;
1089 item->folder->trash = new_item;
1092 mh_scan_tree_recursive(new_item);
1093 } else if (to_number(d->d_name) != -1) n_msg++;
1102 gint new, unread, total, min, max;
1104 procmsg_get_mark_sum(item->path, &new, &unread, &total,
1106 if (n_msg > total) {
1107 new += n_msg - total;
1108 unread += n_msg - total;
1111 item->unread = unread;
1112 item->total = n_msg;
1117 static gboolean mh_rename_folder_func(GNode *node, gpointer data)
1119 FolderItem *item = node->data;
1120 gchar **paths = data;
1121 const gchar *oldpath = paths[0];
1122 const gchar *newpath = paths[1];
1124 gchar *new_itempath;
1127 oldpathlen = strlen(oldpath);
1128 if (strncmp(oldpath, item->path, oldpathlen) != 0) {
1129 g_warning("path doesn't match: %s, %s\n", oldpath, item->path);
1133 base = item->path + oldpathlen;
1134 while (*base == G_DIR_SEPARATOR) base++;
1136 new_itempath = g_strdup(newpath);
1138 new_itempath = g_strconcat(newpath, G_DIR_SEPARATOR_S, base,
1141 item->path = new_itempath;