aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/importers
diff options
context:
space:
mode:
authorTor Lillqvist <tml@novell.com>2005-11-25 23:43:24 +0800
committerTor Lillqvist <tml@src.gnome.org>2005-11-25 23:43:24 +0800
commitf7750eddc35b618c2166004fe020a33a82b31792 (patch)
treeac3abfa58acd4327338ff502f31e2d78ee8d2f89 /addressbook/importers
parente52ac86fca49e157eb21af1c68099301a7714998 (diff)
downloadgsoc2013-evolution-f7750eddc35b618c2166004fe020a33a82b31792.tar.gz
gsoc2013-evolution-f7750eddc35b618c2166004fe020a33a82b31792.tar.zst
gsoc2013-evolution-f7750eddc35b618c2166004fe020a33a82b31792.zip
Use g_filename_from_uri() instead of just stripping off the "file://"
2005-11-25 Tor Lillqvist <tml@novell.com> * importers/evolution-ldif-importer.c (ldif_import): Use g_filename_from_uri() instead of just stripping off the "file://" prefix for Win32 portability. Use gstdio wrappers for better non-ASCII filename support on Windows. svn path=/trunk/; revision=30673
Diffstat (limited to 'addressbook/importers')
-rw-r--r--addressbook/importers/evolution-ldif-importer.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/addressbook/importers/evolution-ldif-importer.c b/addressbook/importers/evolution-ldif-importer.c
index e37d579726..dfec5dfc51 100644
--- a/addressbook/importers/evolution-ldif-importer.c
+++ b/addressbook/importers/evolution-ldif-importer.c
@@ -23,6 +23,7 @@
#include <string.h>
#include <glib/gi18n.h>
+#include <glib/gstdio.h>
#include <gtk/gtkvbox.h>
@@ -690,8 +691,9 @@ ldif_import(EImport *ei, EImportTarget *target, EImportImporter *im)
{
LDIFImporter *gci;
EBook *book;
- FILE *file;
+ FILE *file = NULL;
EImportTargetURI *s = (EImportTargetURI *)target;
+ gchar *filename;
book = e_book_new(g_datalist_get_data(&target->data, "ldif-source"), NULL);
if (book == NULL) {
@@ -700,7 +702,11 @@ ldif_import(EImport *ei, EImportTarget *target, EImportImporter *im)
return;
}
- file = fopen(s->uri_src+7, "r");
+ filename = g_filename_from_uri(s->uri_src, NULL, NULL);
+ if (filename != NULL) {
+ file = g_fopen(filename, "r");
+ g_free (filename);
+ }
if (file == NULL) {
g_message(G_STRLOC ":Can't open .ldif file");
e_import_complete(ei, target);