2 * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3 * Copyright (C) 1999-2005 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
27 #include <glib/gi18n.h>
37 # include <sys/time.h>
43 #include "procheader.h"
47 /* Define possible missing constants for Windows. */
60 static void mh_folder_init (Folder *folder,
64 static Folder *mh_folder_new (const gchar *name,
66 static void mh_folder_destroy (Folder *folder);
67 static gchar *mh_fetch_msg (Folder *folder,
70 static MsgInfo *mh_get_msginfo (Folder *folder,
73 static gint mh_add_msg (Folder *folder,
77 static gint mh_add_msgs (Folder *folder,
81 static gint mh_copy_msg (Folder *folder,
84 static gint mh_remove_msg (Folder *folder,
87 static gint mh_remove_all_msg (Folder *folder,
89 static gboolean mh_is_msg_changed (Folder *folder,
93 static gint mh_get_num_list (Folder *folder,
96 gboolean *old_uids_valid);
97 static gint mh_scan_tree (Folder *folder);
99 static gint mh_create_tree (Folder *folder);
100 static FolderItem *mh_create_folder (Folder *folder,
103 static gint mh_rename_folder (Folder *folder,
106 static gint mh_remove_folder (Folder *folder,
109 static gchar *mh_get_new_msg_filename (FolderItem *dest);
111 static MsgInfo *mh_parse_msg (const gchar *file,
113 static void mh_remove_missing_folder_items (Folder *folder);
114 static gchar *mh_filename_from_utf8 (const gchar *path);
115 static gchar *mh_filename_to_utf8 (const gchar *path);
116 static void mh_scan_tree_recursive (FolderItem *item);
118 static gboolean mh_rename_folder_func (GNode *node,
120 static gchar *mh_item_get_path (Folder *folder,
123 static gboolean mh_scan_required (Folder *folder,
126 static FolderClass mh_class;
128 FolderClass *mh_get_class(void)
130 if (mh_class.idstr == NULL) {
131 mh_class.type = F_MH;
132 mh_class.idstr = "mh";
133 mh_class.uistr = "MH";
135 /* Folder functions */
136 mh_class.new_folder = mh_folder_new;
137 mh_class.destroy_folder = mh_folder_destroy;
138 mh_class.set_xml = folder_local_set_xml;
139 mh_class.get_xml = folder_local_get_xml;
140 mh_class.scan_tree = mh_scan_tree;
141 mh_class.create_tree = mh_create_tree;
143 /* FolderItem functions */
144 mh_class.item_get_path = mh_item_get_path;
145 mh_class.create_folder = mh_create_folder;
146 mh_class.rename_folder = mh_rename_folder;
147 mh_class.remove_folder = mh_remove_folder;
148 mh_class.get_num_list = mh_get_num_list;
149 mh_class.scan_required = mh_scan_required;
151 /* Message functions */
152 mh_class.get_msginfo = mh_get_msginfo;
153 mh_class.fetch_msg = mh_fetch_msg;
154 mh_class.add_msg = mh_add_msg;
155 mh_class.add_msgs = mh_add_msgs;
156 mh_class.copy_msg = mh_copy_msg;
157 mh_class.remove_msg = mh_remove_msg;
158 mh_class.remove_all_msg = mh_remove_all_msg;
159 mh_class.is_msg_changed = mh_is_msg_changed;
165 static Folder *mh_folder_new(const gchar *name, const gchar *path)
169 folder = (Folder *)g_new0(MHFolder, 1);
170 folder->klass = &mh_class;
171 mh_folder_init(folder, name, path);
176 static void mh_folder_destroy(Folder *folder)
178 folder_local_folder_destroy(LOCAL_FOLDER(folder));
181 static void mh_folder_init(Folder *folder, const gchar *name, const gchar *path)
183 folder_local_folder_init(folder, name, path);
187 gboolean mh_scan_required(Folder *folder, FolderItem *item)
192 path = folder_item_get_path(item);
193 g_return_val_if_fail(path != NULL, FALSE);
195 if (stat(path, &s) < 0) {
196 FILE_OP_ERROR(path, "stat");
201 if ((s.st_mtime > item->mtime) &&
202 (s.st_mtime - 3600 != item->mtime)) {
203 debug_print("MH scan required, folder updated: %s (%ld > %ld)\n",
205 (long int) s.st_mtime,
206 (long int) item->mtime);
211 debug_print("MH scan not required: %s (%ld <= %ld)\n",
213 (long int) s.st_mtime,
214 (long int) item->mtime);
219 void mh_get_last_num(Folder *folder, FolderItem *item)
227 g_return_if_fail(item != NULL);
229 debug_print("mh_get_last_num(): Scanning %s ...\n", item->path);
231 path = folder_item_get_path(item);
232 g_return_if_fail(path != NULL);
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 dirent_is_regular_file(d)) {
253 debug_print("Last number in dir %s = %d\n", item->path, max);
254 item->last_num = max;
257 gint mh_get_num_list(Folder *folder, FolderItem *item, GSList **list, gboolean *old_uids_valid)
263 gint num, nummsgs = 0;
265 g_return_val_if_fail(item != NULL, -1);
267 debug_print("mh_get_num_list(): Scanning %s ...\n", item->path);
269 *old_uids_valid = TRUE;
271 path = folder_item_get_path(item);
272 g_return_val_if_fail(path != NULL, -1);
273 if (change_dir(path) < 0) {
279 if ((dp = opendir(".")) == NULL) {
280 FILE_OP_ERROR(item->path, "opendir");
284 while ((d = readdir(dp)) != NULL) {
285 if ((num = to_number(d->d_name)) > 0) {
286 *list = g_slist_prepend(*list, GINT_TO_POINTER(num));
292 item->mtime = time(NULL);
296 static gchar *mh_fetch_msg(Folder *folder, FolderItem *item, gint num)
301 g_return_val_if_fail(item != NULL, NULL);
302 g_return_val_if_fail(num > 0, NULL);
304 path = folder_item_get_path(item);
305 file = g_strconcat(path, G_DIR_SEPARATOR_S, itos(num), NULL);
307 if (!is_file_exist(file)) {
316 static MsgInfo *mh_get_msginfo(Folder *folder, FolderItem *item, gint num)
321 g_return_val_if_fail(item != NULL, NULL);
322 g_return_val_if_fail(num > 0, NULL);
324 file = mh_fetch_msg(folder, item, num);
325 if (!file) return NULL;
327 msginfo = mh_parse_msg(file, item);
329 msginfo->msgnum = num;
336 static gchar *mh_get_new_msg_filename(FolderItem *dest)
341 destpath = folder_item_get_path(dest);
342 g_return_val_if_fail(destpath != NULL, NULL);
344 if (!is_dir_exist(destpath))
345 make_dir_hier(destpath);
348 destfile = g_strdup_printf("%s%c%d", destpath, G_DIR_SEPARATOR,
350 if (is_file_entry_exist(destfile)) {
362 static gint mh_add_msg(Folder *folder, FolderItem *dest, const gchar *file, MsgFlags *flags)
366 MsgFileInfo fileinfo;
368 g_return_val_if_fail(file != NULL, -1);
370 fileinfo.msginfo = NULL;
371 fileinfo.file = (gchar *)file;
372 fileinfo.flags = flags;
373 file_list.data = &fileinfo;
374 file_list.next = NULL;
376 ret = mh_add_msgs(folder, dest, &file_list, NULL);
380 static gint mh_add_msgs(Folder *folder, FolderItem *dest, GSList *file_list,
385 MsgFileInfo *fileinfo;
387 g_return_val_if_fail(dest != NULL, -1);
388 g_return_val_if_fail(file_list != NULL, -1);
390 if (dest->last_num < 0) {
391 mh_get_last_num(folder, dest);
392 if (dest->last_num < 0) return -1;
395 for (cur = file_list; cur != NULL; cur = cur->next) {
396 fileinfo = (MsgFileInfo *)cur->data;
398 destfile = mh_get_new_msg_filename(dest);
399 if (destfile == NULL) return -1;
402 if (link(fileinfo->file, destfile) < 0) {
404 if (copy_file(fileinfo->file, destfile, TRUE) < 0) {
405 g_warning(_("can't copy message %s to %s\n"),
406 fileinfo->file, destfile);
414 if (relation != NULL)
415 g_relation_insert(relation, fileinfo, GINT_TO_POINTER(dest->last_num + 1));
420 return dest->last_num;
423 static gint mh_copy_msg(Folder *folder, FolderItem *dest, MsgInfo *msginfo)
425 gboolean dest_need_scan = FALSE;
429 FolderItemPrefs *prefs;
431 g_return_val_if_fail(dest != NULL, -1);
432 g_return_val_if_fail(msginfo != NULL, -1);
434 if (msginfo->folder == dest) {
435 g_warning("the src folder is identical to the dest.\n");
439 if (dest->last_num < 0) {
440 mh_get_last_num(folder, dest);
441 if (dest->last_num < 0) return -1;
446 srcfile = procmsg_get_message_file(msginfo);
447 destfile = mh_get_new_msg_filename(dest);
453 debug_print("Copying message %s%c%d to %s ...\n",
454 msginfo->folder->path, G_DIR_SEPARATOR,
455 msginfo->msgnum, dest->path);
458 if ((MSG_IS_QUEUED(msginfo->flags) || MSG_IS_DRAFT(msginfo->flags))
459 && !folder_has_parent_of_type(dest, F_QUEUE)
460 && !folder_has_parent_of_type(dest, F_DRAFT)) {
461 if (procmsg_remove_special_headers(srcfile, destfile) !=0) {
466 } else if (!(MSG_IS_QUEUED(msginfo->flags) || MSG_IS_DRAFT(msginfo->flags))
467 && (folder_has_parent_of_type(dest, F_QUEUE)
468 || folder_has_parent_of_type(dest, F_DRAFT))) {
472 } else if (copy_file(srcfile, destfile, TRUE) < 0) {
473 FILE_OP_ERROR(srcfile, "copy");
479 dest_need_scan = mh_scan_required(dest->folder, dest);
481 dest->mtime = time(NULL);
484 if (prefs && prefs->enable_folder_chmod && prefs->folder_chmod) {
485 if (chmod(destfile, prefs->folder_chmod) < 0)
486 FILE_OP_ERROR(destfile, "chmod");
489 filemode = prefs->folder_chmod;
490 if (filemode & S_IRGRP) filemode |= S_IWGRP;
491 if (filemode & S_IROTH) filemode |= S_IWOTH;
498 return dest->last_num;
501 static gint mh_remove_msg(Folder *folder, FolderItem *item, gint num)
503 gboolean need_scan = FALSE;
506 g_return_val_if_fail(item != NULL, -1);
508 file = mh_fetch_msg(folder, item, num);
509 g_return_val_if_fail(file != NULL, -1);
511 need_scan = mh_scan_required(folder, item);
513 if (g_unlink(file) < 0) {
514 FILE_OP_ERROR(file, "unlink");
520 item->mtime = time(NULL);
526 static gint mh_remove_all_msg(Folder *folder, FolderItem *item)
531 g_return_val_if_fail(item != NULL, -1);
533 path = folder_item_get_path(item);
534 g_return_val_if_fail(path != NULL, -1);
535 val = remove_all_numbered_files(path);
541 static gboolean mh_is_msg_changed(Folder *folder, FolderItem *item,
546 if (g_stat(itos(msginfo->msgnum), &s) < 0 ||
547 msginfo->size != s.st_size || (
548 (msginfo->mtime - s.st_mtime != 0) &&
549 (msginfo->mtime - s.st_mtime != 3600) &&
550 (msginfo->mtime - s.st_mtime != -3600)))
556 static gint mh_scan_tree(Folder *folder)
561 g_return_val_if_fail(folder != NULL, -1);
564 item = folder_item_new(folder, folder->name, NULL);
565 item->folder = folder;
566 folder->node = item->node = g_node_new(item);
568 item = FOLDER_ITEM(folder->node->data);
570 rootpath = folder_item_get_path(item);
571 if (change_dir(rootpath) < 0) {
577 mh_create_tree(folder);
578 mh_remove_missing_folder_items(folder);
579 mh_scan_tree_recursive(item);
584 #define MAKE_DIR_IF_NOT_EXIST(dir) \
586 if (!is_dir_exist(dir)) { \
587 if (is_file_exist(dir)) { \
588 g_warning("File `%s' already exists.\n" \
589 "Can't create folder.", dir); \
592 if (make_dir(dir) < 0) \
597 static gint mh_create_tree(Folder *folder)
601 g_return_val_if_fail(folder != NULL, -1);
603 CHDIR_RETURN_VAL_IF_FAIL(get_mail_base_dir(), -1);
604 rootpath = LOCAL_FOLDER(folder)->rootpath;
605 MAKE_DIR_IF_NOT_EXIST(rootpath);
606 CHDIR_RETURN_VAL_IF_FAIL(rootpath, -1);
607 MAKE_DIR_IF_NOT_EXIST(INBOX_DIR);
608 MAKE_DIR_IF_NOT_EXIST(OUTBOX_DIR);
609 MAKE_DIR_IF_NOT_EXIST(QUEUE_DIR);
610 MAKE_DIR_IF_NOT_EXIST(DRAFT_DIR);
611 MAKE_DIR_IF_NOT_EXIST(TRASH_DIR);
616 #undef MAKE_DIR_IF_NOT_EXIST
618 static gchar *mh_item_get_path(Folder *folder, FolderItem *item)
620 gchar *folder_path, *path;
622 g_return_val_if_fail(folder != NULL, NULL);
623 g_return_val_if_fail(item != NULL, NULL);
625 folder_path = g_strdup(LOCAL_FOLDER(folder)->rootpath);
626 g_return_val_if_fail(folder_path != NULL, NULL);
628 /* FIXME: [W32] The code below does not correctly merge
629 relative filenames; there should be a function to handle
631 if ( !is_relative_filename (folder_path) ) {
633 path = g_strconcat(folder_path, G_DIR_SEPARATOR_S,
636 path = g_strdup(folder_path);
639 path = g_strconcat(get_home_dir(), G_DIR_SEPARATOR_S,
640 folder_path, G_DIR_SEPARATOR_S,
643 path = g_strconcat(get_home_dir(), G_DIR_SEPARATOR_S,
647 real_path = mh_filename_from_utf8(path);
648 if (!is_dir_exist(real_path) && is_dir_exist(path)) {
649 /* mmh, older version did put utf8 filenames instead of
650 * the correct encoding */
651 rename(path, real_path);
652 folder_item_scan(item);
659 static FolderItem *mh_create_folder(Folder *folder, FolderItem *parent,
662 gchar *path, *real_name;
664 FolderItem *new_item;
665 gchar *mh_sequences_filename;
666 FILE *mh_sequences_file;
668 g_return_val_if_fail(folder != NULL, NULL);
669 g_return_val_if_fail(parent != NULL, NULL);
670 g_return_val_if_fail(name != NULL, NULL);
672 path = folder_item_get_path(parent);
673 if (!is_dir_exist(path))
674 if (make_dir_hier(path) != 0)
677 real_name = mh_filename_from_utf8(name);
678 fullpath = g_strconcat(path, G_DIR_SEPARATOR_S, real_name, NULL);
682 if (make_dir(fullpath) < 0) {
690 path = g_strconcat(parent->path, G_DIR_SEPARATOR_S, name,
693 path = g_strdup(name);
694 new_item = folder_item_new(folder, name, path);
695 folder_item_append(parent, new_item);
699 path = folder_item_get_path(new_item);
700 mh_sequences_filename = g_strconcat(path, G_DIR_SEPARATOR_S,
701 ".mh_sequences", NULL);
702 if ((mh_sequences_file = g_fopen(mh_sequences_filename, "a+b")) != NULL) {
703 fclose(mh_sequences_file);
705 g_free(mh_sequences_filename);
711 static gint mh_rename_folder(Folder *folder, FolderItem *item,
717 gchar *newpath, *utf8newpath;
720 g_return_val_if_fail(folder != NULL, -1);
721 g_return_val_if_fail(item != NULL, -1);
722 g_return_val_if_fail(item->path != NULL, -1);
723 g_return_val_if_fail(name != NULL, -1);
725 oldpath = folder_item_get_path(item);
726 if (!is_dir_exist(oldpath))
727 make_dir_hier(oldpath);
729 dirname = g_path_get_dirname(oldpath);
730 real_name = mh_filename_from_utf8(name);
731 newpath = g_strconcat(dirname, G_DIR_SEPARATOR_S, real_name, NULL);
734 if (g_rename(oldpath, newpath) < 0) {
735 FILE_OP_ERROR(oldpath, "rename");
744 if (strchr(item->path, G_DIR_SEPARATOR) != NULL) {
745 dirname = g_path_get_dirname(item->path);
746 utf8newpath = g_strconcat(dirname, G_DIR_SEPARATOR_S,
750 utf8newpath = g_strdup(name);
753 item->name = g_strdup(name);
755 paths[0] = g_strdup(item->path);
756 paths[1] = utf8newpath;
757 g_node_traverse(item->node, G_PRE_ORDER, G_TRAVERSE_ALL, -1,
758 mh_rename_folder_func, paths);
765 static gint mh_remove_folder(Folder *folder, FolderItem *item)
769 g_return_val_if_fail(folder != NULL, -1);
770 g_return_val_if_fail(item != NULL, -1);
771 g_return_val_if_fail(item->path != NULL, -1);
773 path = folder_item_get_path(item);
774 if (remove_dir_recursive(path) < 0) {
775 g_warning("can't remove directory `%s'\n", path);
781 folder_item_remove(item);
785 static MsgInfo *mh_parse_msg(const gchar *file, FolderItem *item)
790 g_return_val_if_fail(item != NULL, NULL);
791 g_return_val_if_fail(file != NULL, NULL);
793 flags.perm_flags = MSG_NEW|MSG_UNREAD;
796 if (folder_has_parent_of_type(item, F_QUEUE)) {
797 MSG_SET_TMP_FLAGS(flags, MSG_QUEUED);
798 } else if (folder_has_parent_of_type(item, F_DRAFT)) {
799 MSG_SET_TMP_FLAGS(flags, MSG_DRAFT);
802 msginfo = procheader_parse_file(file, flags, FALSE, FALSE);
803 if (!msginfo) return NULL;
805 msginfo->msgnum = atoi(file);
806 msginfo->folder = item;
812 static gboolean mh_is_maildir_one(const gchar *path, const gchar *dir)
817 entry = g_strconcat(path, G_DIR_SEPARATOR_S, dir, NULL);
818 result = is_dir_exist(entry);
825 * check whether PATH is a Maildir style mailbox.
826 * This is the case if the 3 subdir: new, cur, tmp are existing.
827 * This functon assumes that entry is an directory
829 static gboolean mh_is_maildir(const gchar *path)
831 return mh_is_maildir_one(path, "new") &&
832 mh_is_maildir_one(path, "cur") &&
833 mh_is_maildir_one(path, "tmp");
837 static gboolean mh_remove_missing_folder_items_func(GNode *node, gpointer data)
842 g_return_val_if_fail(node->data != NULL, FALSE);
844 if (G_NODE_IS_ROOT(node))
847 item = FOLDER_ITEM(node->data);
849 path = folder_item_get_path(item);
850 if (!is_dir_exist(path)) {
851 debug_print("folder '%s' not found. removing...\n", path);
852 folder_item_remove(item);
859 static void mh_remove_missing_folder_items(Folder *folder)
861 g_return_if_fail(folder != NULL);
863 debug_print("searching missing folders...\n");
865 g_node_traverse(folder->node, G_POST_ORDER, G_TRAVERSE_ALL, -1,
866 mh_remove_missing_folder_items_func, folder);
869 static void mh_scan_tree_recursive(FolderItem *item)
878 const gchar *dir_name;
880 gchar *real_path, *entry, *utf8entry, *utf8name;
883 g_return_if_fail(item != NULL);
884 g_return_if_fail(item->folder != NULL);
886 folder = item->folder;
888 real_path = item->path ? mh_filename_from_utf8(item->path) : g_strdup(".");
890 dir = g_dir_open(real_path, 0, NULL);
892 g_warning("failed to open directory: %s\n", real_path);
897 dp = opendir(real_path);
899 FILE_OP_ERROR(real_path, "opendir");
905 debug_print("scanning %s ...\n",
906 item->path ? item->path
907 : LOCAL_FOLDER(item->folder)->rootpath);
909 folder->ui_func(folder, item, folder->ui_func_data);
912 while ((dir_name = g_dir_read_name(dir)) != NULL) {
914 while ((d = readdir(dp)) != NULL) {
915 dir_name = d->d_name;
917 if (dir_name[0] == '.') continue;
919 utf8name = mh_filename_to_utf8(dir_name);
921 utf8entry = g_strconcat(item->path, G_DIR_SEPARATOR_S,
924 utf8entry = g_strdup(utf8name);
925 entry = mh_filename_from_utf8(utf8entry);
928 #if !defined(G_OS_WIN32) && defined(HAVE_DIRENT_D_TYPE)
929 d->d_type == DT_DIR ||
930 (d->d_type == DT_UNKNOWN &&
932 g_stat(entry, &s) == 0 && S_ISDIR(s.st_mode)
933 #if !defined(G_OS_WIN32) && defined(HAVE_DIRENT_D_TYPE)
937 FolderItem *new_item = NULL;
941 if (mh_is_maildir(entry)) {
950 for (node = node->children; node != NULL; node = node->next) {
951 FolderItem *cur_item = FOLDER_ITEM(node->data);
952 if (!strcmp2(cur_item->path, entry)) {
958 debug_print("new folder '%s' found.\n", entry);
959 new_item = folder_item_new(folder, utf8name, utf8entry);
960 folder_item_append(item, new_item);
964 if (!folder->inbox &&
965 !strcmp(dir_name, INBOX_DIR)) {
966 new_item->stype = F_INBOX;
967 folder->inbox = new_item;
968 } else if (!folder->outbox &&
969 !strcmp(dir_name, OUTBOX_DIR)) {
970 new_item->stype = F_OUTBOX;
971 folder->outbox = new_item;
972 } else if (!folder->draft &&
973 !strcmp(dir_name, DRAFT_DIR)) {
974 new_item->stype = F_DRAFT;
975 folder->draft = new_item;
976 } else if (!folder->queue &&
977 !strcmp(dir_name, QUEUE_DIR)) {
978 new_item->stype = F_QUEUE;
979 folder->queue = new_item;
980 } else if (!folder->trash &&
981 !strcmp(dir_name, TRASH_DIR)) {
982 new_item->stype = F_TRASH;
983 folder->trash = new_item;
987 mh_scan_tree_recursive(new_item);
988 } else if (to_number(dir_name) > 0) n_msg++;
1001 item->mtime = time(NULL);
1005 gint new, unread, total, min, max;
1007 procmsg_get_mark_sum(item->path, &new, &unread, &total,
1009 if (n_msg > total) {
1010 new += n_msg - total;
1011 unread += n_msg - total;
1014 item->unread = unread;
1015 item->total = n_msg;
1020 static gboolean mh_rename_folder_func(GNode *node, gpointer data)
1022 FolderItem *item = node->data;
1023 gchar **paths = data;
1024 const gchar *oldpath = paths[0];
1025 const gchar *newpath = paths[1];
1027 gchar *new_itempath;
1030 oldpathlen = strlen(oldpath);
1031 if (strncmp(oldpath, item->path, oldpathlen) != 0) {
1032 g_warning("path doesn't match: %s, %s\n", oldpath, item->path);
1036 base = item->path + oldpathlen;
1037 while (*base == G_DIR_SEPARATOR) base++;
1039 new_itempath = g_strdup(newpath);
1041 new_itempath = g_strconcat(newpath, G_DIR_SEPARATOR_S, base,
1044 item->path = new_itempath;
1049 static gchar *mh_filename_from_utf8(const gchar *path)
1051 gchar *real_path = g_filename_from_utf8(path, -1, NULL, NULL, NULL);
1054 g_warning("mh_filename_from_utf8: faild to convert character set\n");
1055 real_path = g_strdup(path);
1061 static gchar *mh_filename_to_utf8(const gchar *path)
1063 gchar *utf8path = g_filename_to_utf8(path, -1, NULL, NULL, NULL);
1065 g_warning("mh_filename_to_utf8: faild to convert character set\n");
1066 utf8path = g_strdup(path);