[evolution-data-server] Avoid absolute paths in "On This Computer" source groups.
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server] Avoid absolute paths in "On This Computer" source groups.
- Date: Thu, 15 Jul 2010 17:14:22 +0000 (UTC)
commit 9e0845207b39f256f7e81d388741ed30a764ea7b
Author: Matthew Barnes <mbarnes redhat com>
Date: Thu Jul 15 13:08:50 2010 -0400
Avoid absolute paths in "On This Computer" source groups.
A base URI of "local:" is sufficient to identify the "On This Computer"
source group. No other source group uses that URI scheme, and it avoids
an entire class of portability problems that come with using an absolute
"file:" URI to point to user-specific data:
- What if the user's home directory is renamed?
- What if settings are moved to a new host under a different user name?
- What if settings are copied to another user account on the same host?
- Migrating to XDG base dirs is otherwise a giant PITA.
libedataserver/e-source-group.c | 22 ++++++++++++++++++++--
1 files changed, 20 insertions(+), 2 deletions(-)
---
diff --git a/libedataserver/e-source-group.c b/libedataserver/e-source-group.c
index c4ca948..219dd3f 100644
--- a/libedataserver/e-source-group.c
+++ b/libedataserver/e-source-group.c
@@ -294,7 +294,16 @@ e_source_group_new_from_xmldoc (xmlDocPtr doc)
new->priv->uid = g_strdup (GC uid);
e_source_group_set_name (new, GC name);
- e_source_group_set_base_uri (new, GC base_uri);
+
+ /* XXX The "On This Computer" group used to specify an
+ * absolute "file:" URI pointing to its local storage
+ * directory, but that caused all kinds of portability
+ * issues so now we just use "local:" and leave the
+ * absolute file system path implicit. */
+ if (g_str_has_prefix (GC base_uri, "file:"))
+ e_source_group_set_base_uri (new, "local:");
+ else
+ e_source_group_set_base_uri (new, GC base_uri);
for (p = root->children; p != NULL; p = p->next) {
ESource *new_source;
@@ -389,7 +398,16 @@ e_source_group_update_from_xmldoc (ESourceGroup *group,
}
xmlFree (name);
- if (strcmp (group->priv->base_uri, GC base_uri) != 0) {
+ /* XXX The "On This Computer" group used to specify an
+ * absolute "file:" URI pointing to its local storage
+ * directory, but that caused all kinds of portability
+ * issues so now we just use "local:" and leave the
+ * absolute file system path implicit. */
+ if (g_str_has_prefix (GC base_uri, "file:")) {
+ g_free (group->priv->base_uri);
+ group->priv->base_uri = g_strdup ("local:");
+ changed = TRUE;
+ } else if (strcmp (group->priv->base_uri, GC base_uri) != 0) {
g_free (group->priv->base_uri);
group->priv->base_uri = g_strdup (GC base_uri);
changed = TRUE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]