diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2004-04-28 02:54:36 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2004-04-28 02:54:36 +0800 |
commit | 319063bd03c95cfcced8dbeb6d755859d4490c36 (patch) | |
tree | 45aa52eac3ba6cb653a6467f30a24379148431a1 /calendar | |
parent | 342bde963e6a4e29ddb6d9f288a521391daf0fd3 (diff) | |
download | gsoc2013-evolution-319063bd03c95cfcced8dbeb6d755859d4490c36.tar gsoc2013-evolution-319063bd03c95cfcced8dbeb6d755859d4490c36.tar.gz gsoc2013-evolution-319063bd03c95cfcced8dbeb6d755859d4490c36.tar.bz2 gsoc2013-evolution-319063bd03c95cfcced8dbeb6d755859d4490c36.tar.lz gsoc2013-evolution-319063bd03c95cfcced8dbeb6d755859d4490c36.tar.xz gsoc2013-evolution-319063bd03c95cfcced8dbeb6d755859d4490c36.tar.zst gsoc2013-evolution-319063bd03c95cfcced8dbeb6d755859d4490c36.zip |
Fixed the version checks for migrating pilot data. (migrate_calendars):
2004-04-27 Jeffrey Stedfast <fejj@ximian.com>
* gui/migration.c (migrate_tasks): Fixed the version checks for
migrating pilot data.
(migrate_calendars): Same.
(migrate_pilot_data): Doh. Take a third argument to specify what
component we are migrating ("todo" vs "calendar") so that we can
compare against the correct filename. Might help :-)
svn path=/trunk/; revision=25638
Diffstat (limited to 'calendar')
-rw-r--r-- | calendar/ChangeLog | 9 | ||||
-rw-r--r-- | calendar/gui/migration.c | 21 |
2 files changed, 23 insertions, 7 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 7bb546ce3d..c58cc0c5eb 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,12 @@ +2004-04-27 Jeffrey Stedfast <fejj@ximian.com> + + * gui/migration.c (migrate_tasks): Fixed the version checks for + migrating pilot data. + (migrate_calendars): Same. + (migrate_pilot_data): Doh. Take a third argument to specify what + component we are migrating ("todo" vs "calendar") so that we can + compare against the correct filename. Might help :-) + 2004-04-27 Kidd Wang <kidd.wang@sun.com> * gui/e-cal-model-tasks.c: (ecmt_set_value_at): compare the start diff --git a/calendar/gui/migration.c b/calendar/gui/migration.c index e039a69215..d649534bf6 100644 --- a/calendar/gui/migration.c +++ b/calendar/gui/migration.c @@ -560,8 +560,9 @@ migrate_pilot_db_key (const char *key, const char *data, gpointer user_data) } static void -migrate_pilot_data (const char *old_path, const char *new_path) +migrate_pilot_data (const char *component, const char *conduit, const char *old_path, const char *new_path) { + char *changelog, *map; struct dirent *dent; const char *ext; char *filename; @@ -570,8 +571,14 @@ migrate_pilot_data (const char *old_path, const char *new_path) if (!(dir = opendir (old_path))) return; + map = g_alloca (12 + strlen (conduit)); + sprintf (map, "pilot-map-%s-", conduit); + + changelog = g_alloca (strlen (component) + 28 + strlen (conduit)); + sprintf (changelog, "%s.ics-pilot-sync-evolution-%s-", component, conduit); + while ((dent = readdir (dir))) { - if (!strncmp (dent->d_name, "pilot-map-todo-", 15) && + if (!strncmp (dent->d_name, map, strlen (map)) && ((ext = strrchr (dent->d_name, '.')) && !strcmp (ext, ".xml"))) { /* pilot map file - src and dest file formats are identical */ unsigned char inbuf[4096]; @@ -627,7 +634,7 @@ migrate_pilot_data (const char *old_path, const char *new_path) close (fd0); close (fd1); g_free (filename); - } else if (strstr (dent->d_name, ".ics-pilot-sync-evolution-todo-") && + } else if (!strncmp (dent->d_name, changelog, strlen (changelog)) && ((ext = strrchr (dent->d_name, '.')) && !strcmp (ext, ".db"))) { /* src and dest formats differ, src format is db3 while dest format is xml */ EXmlHash *xmlhash; @@ -761,13 +768,13 @@ migrate_calendars (CalendarComponent *component, int major, int minor, int revis g_object_unref (gconf); } - if (minor <= 5 && revision <= 9) { + if (minor < 5 || (minor == 5 && revision <= 9)) { char *old_path, *new_path; old_path = g_build_filename (g_get_home_dir (), "evolution", "local", "Calendar", NULL); new_path = g_build_filename (calendar_component_peek_base_directory (component), "calendar", "local", "system", NULL); - migrate_pilot_data (old_path, new_path); + migrate_pilot_data ("calendar", "calendar", old_path, new_path); g_free (new_path); g_free (old_path); } @@ -862,13 +869,13 @@ migrate_tasks (TasksComponent *component, int major, int minor, int revision) dialog_close (); } - if (minor <= 5 && revision <= 9) { + if (minor < 5 || (minor == 5 && revision <= 9)) { char *old_path, *new_path; old_path = g_build_filename (g_get_home_dir (), "evolution", "local", "Tasks", NULL); new_path = g_build_filename (tasks_component_peek_base_directory (component), "tasks", "local", "system", NULL); - migrate_pilot_data (old_path, new_path); + migrate_pilot_data ("tasks", "todo", old_path, new_path); g_free (new_path); g_free (old_path); } |