From d8fc2ee08bf048d48f01d9c08583f5c1b4f2b4ed Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Sat, 17 Dec 2005 12:19:36 +0000 Subject: Use GLib to construct filenames from URIs and back. 2005-12-17 Tor Lillqvist * conduits/calendar/calendar-conduit.c: Use GLib to construct filenames from URIs and back. svn path=/trunk/; revision=30803 --- calendar/ChangeLog | 5 +++++ calendar/conduits/calendar/calendar-conduit.c | 13 ++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) (limited to 'calendar') diff --git a/calendar/ChangeLog b/calendar/ChangeLog index a6aec0e39b..6ea6635ebd 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,8 @@ +2005-12-17 Tor Lillqvist + + * conduits/calendar/calendar-conduit.c: Use GLib to construct + filenames from URIs and back. + 2005-12-15 Srinivasa Ragavan ** Fixes bug #324094 diff --git a/calendar/conduits/calendar/calendar-conduit.c b/calendar/conduits/calendar/calendar-conduit.c index 531773ef08..e8840ecddd 100644 --- a/calendar/conduits/calendar/calendar-conduit.c +++ b/calendar/conduits/calendar/calendar-conduit.c @@ -150,22 +150,29 @@ calconduit_load_configuration (guint32 pilot_id) c->secret = gnome_config_get_bool ("secret=FALSE"); c->multi_day_split = gnome_config_get_bool ("multi_day_split=TRUE"); if ((c->last_uri = gnome_config_get_string ("last_uri")) && !strncmp (c->last_uri, "file://", 7)) { - const char *path = c->last_uri + 7; + char *filename = g_filename_from_uri (c->last_uri, NULL, NULL); + const char *path = filename; const char *home; home = g_get_home_dir (); if (!strncmp (path, home, strlen (home))) { path += strlen (home); - if (*path == '/') + if (G_IS_DIR_SEPARATOR (*path)) path++; if (!strcmp (path, "evolution/local/Calendar/calendar.ics")) { + gchar *new_filename = + g_build_filename (home, + ".evolution/calendar/local/system/calendar.ics", + NULL); /* need to upgrade the last_uri. yay. */ g_free (c->last_uri); - c->last_uri = g_strdup_printf ("file://%s/.evolution/calendar/local/system/calendar.ics", home); + c->last_uri = g_filename_to_uri (new_filename); + g_free (new_filename); } } + g_free (filename); } gnome_config_pop_prefix (); -- cgit v1.2.3