From 9cb5a32884a874d7143fdb846871a2083fe9e022 Mon Sep 17 00:00:00 2001 From: hiro Date: Tue, 3 Apr 2007 04:47:36 +0000 Subject: win32: fixed a bug that the path separator of FolderItem::path was not processed correctly. git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@1589 ee746299-78ed-0310-b773-934348b2243d --- libsylph/folder.c | 3 --- libsylph/imap.c | 26 ++++++++++---------------- libsylph/mh.c | 41 ++++++++++++++++++----------------------- 3 files changed, 28 insertions(+), 42 deletions(-) (limited to 'libsylph') diff --git a/libsylph/folder.c b/libsylph/folder.c index 7edd391b..c63d5ba7 100644 --- a/libsylph/folder.c +++ b/libsylph/folder.c @@ -673,9 +673,6 @@ gchar *folder_item_get_identifier(FolderItem *item) folder_id = folder_get_identifier(item->folder); id = g_strconcat(folder_id, "/", item->path, NULL); -#ifdef G_OS_WIN32 - subst_char(id, G_DIR_SEPARATOR, '/'); -#endif g_free(folder_id); return id; diff --git a/libsylph/imap.c b/libsylph/imap.c index caff7255..bcac6355 100644 --- a/libsylph/imap.c +++ b/libsylph/imap.c @@ -1368,15 +1368,13 @@ static gint imap_do_copy_msgs(Folder *folder, FolderItem *dest, GSList *msglist, if (remove_source) { status_print(_("Moving messages %s to %s ..."), seq_set, dest->path); - debug_print("Moving message %s%c[%s] to %s ...\n", - src->path, G_DIR_SEPARATOR, - seq_set, dest->path); + debug_print("Moving message %s/[%s] to %s ...\n", + src->path, seq_set, dest->path); } else { status_print(_("Copying messages %s to %s ..."), seq_set, dest->path); - debug_print("Copying message %s%c[%s] to %s ...\n", - src->path, G_DIR_SEPARATOR, - seq_set, dest->path); + debug_print("Copying message %s/[%s] to %s ...\n", + src->path, seq_set, dest->path); } progress_show(count, total); ui_update(); @@ -2207,8 +2205,7 @@ static gint imap_rename_folder_real(Folder *folder, FolderItem *item, if (name) { if (new_parent->path) newpath = g_strconcat(new_parent->path, - G_DIR_SEPARATOR_S, name, - NULL); + "/", name, NULL); else newpath = g_strdup(name); } else { @@ -2217,20 +2214,18 @@ static gint imap_rename_folder_real(Folder *folder, FolderItem *item, name_ = g_path_get_basename(item->path); if (new_parent->path) newpath = g_strconcat(new_parent->path, - G_DIR_SEPARATOR_S, name_, - NULL); + "/", name_, NULL); else newpath = g_strdup(name_); AUTORELEASE_STR(name_, ); name = name_; } } else { - if (strchr(item->path, G_DIR_SEPARATOR)) { + if (strchr(item->path, '/')) { gchar *dirpath; dirpath = g_dirname(item->path); - newpath = g_strconcat(dirpath, G_DIR_SEPARATOR_S, name, - NULL); + newpath = g_strconcat(dirpath, "/", name, NULL); g_free(dirpath); } else newpath = g_strdup(name); @@ -4390,12 +4385,11 @@ static gboolean imap_rename_folder_func(GNode *node, gpointer data) } base = item->path + oldpathlen; - while (*base == G_DIR_SEPARATOR) base++; + while (*base == '/') base++; if (*base == '\0') new_itempath = g_strdup(newpath); else - new_itempath = g_strconcat(newpath, G_DIR_SEPARATOR_S, base, - NULL); + new_itempath = g_strconcat(newpath, "/", base, NULL); g_free(item->path); item->path = new_itempath; diff --git a/libsylph/mh.c b/libsylph/mh.c index 1ba2770e..67be7a7a 100644 --- a/libsylph/mh.c +++ b/libsylph/mh.c @@ -547,9 +547,8 @@ static gint mh_do_move_msgs(Folder *folder, FolderItem *dest, GSList *msglist) g_warning(_("the src folder is identical to the dest.\n")); continue; } - debug_print("Moving message %s%c%d to %s ...\n", - src->path, G_DIR_SEPARATOR, msginfo->msgnum, - dest->path); + debug_print("Moving message %s/%d to %s ...\n", + src->path, msginfo->msgnum, dest->path); destfile = mh_get_new_msg_filename(dest); if (!destfile) break; @@ -669,9 +668,8 @@ static gint mh_copy_msgs(Folder *folder, FolderItem *dest, GSList *msglist) g_warning(_("the src folder is identical to the dest.\n")); continue; } - debug_print(_("Copying message %s%c%d to %s ...\n"), - msginfo->folder->path, G_DIR_SEPARATOR, - msginfo->msgnum, dest->path); + debug_print(_("Copying message %s/%d to %s ...\n"), + msginfo->folder->path, msginfo->msgnum, dest->path); destfile = mh_get_new_msg_filename(dest); if (!destfile) break; @@ -1173,17 +1171,15 @@ static gint mh_move_folder_real(Folder *folder, FolderItem *item, g_node_append(new_parent->node, item->node); item->parent = new_parent; if (new_parent->path != NULL) { - newpath = g_strconcat(new_parent->path, - G_DIR_SEPARATOR_S, utf8_name, + newpath = g_strconcat(new_parent->path, "/", utf8_name, NULL); g_free(utf8_name); } else newpath = utf8_name; } else { - if (strchr(item->path, G_DIR_SEPARATOR) != NULL) { + if (strchr(item->path, '/') != NULL) { dirname = g_dirname(item->path); - newpath = g_strconcat(dirname, G_DIR_SEPARATOR_S, - utf8_name, NULL); + newpath = g_strconcat(dirname, "/", utf8_name, NULL); g_free(dirname); g_free(utf8_name); } else @@ -1507,14 +1503,17 @@ static void mh_scan_tree_recursive(FolderItem *item) utf8name = g_strdup(dir_name); #endif - if (item->path) - utf8entry = g_strconcat(item->path, G_DIR_SEPARATOR_S, - utf8name, NULL); - else + if (item->path) { + utf8entry = g_strconcat(item->path, "/", utf8name, + NULL); + } else utf8entry = g_strdup(utf8name); entry = g_filename_from_utf8(utf8entry, -1, NULL, NULL, NULL); if (!entry) entry = g_strdup(utf8entry); +#ifdef G_OS_WIN32 + subst_char(entry, '/', G_DIR_SEPARATOR); +#endif if ( #ifdef G_OS_WIN32 @@ -1553,17 +1552,14 @@ static void mh_scan_tree_recursive(FolderItem *item) node = item->node; for (node = node->children; node != NULL; node = node->next) { FolderItem *cur_item = FOLDER_ITEM(node->data); -#ifdef G_OS_WIN32 - if (!path_cmp(cur_item->path, utf8entry)) { -#else if (!strcmp2(cur_item->path, utf8entry)) { -#endif new_item = cur_item; break; } } if (!new_item) { - debug_print("new folder '%s' found.\n", entry); + debug_print("new folder '%s' found.\n", + utf8entry); new_item = folder_item_new(utf8name, utf8entry); folder_item_append(item, new_item); } @@ -1644,12 +1640,11 @@ static gboolean mh_rename_folder_func(GNode *node, gpointer data) } base = item->path + oldpathlen; - while (*base == G_DIR_SEPARATOR) base++; + while (*base == '/') base++; if (*base == '\0') new_itempath = g_strdup(newpath); else - new_itempath = g_strconcat(newpath, G_DIR_SEPARATOR_S, base, - NULL); + new_itempath = g_strconcat(newpath, "/", base, NULL); g_free(item->path); item->path = new_itempath; -- cgit v1.2.3