Hi,
Here is a little patch to fix inconsistency between libtracker and
tracker-control, regarding how they find the path to the config/data dirs.
Regards,
Florent Viard
Software Development Engineer
........................................
[email protected]
Phone: +33 1 58 49 57 20
Fax: +33 1 58 49 57 20
33, boulevard du Général Martial Valin
75015 Paris - FRANCE
www.lacie.com
Please print only if necessary
This e-mail and any attachment are confidential and intended solely for the use
of the individual to whom it is addressed. If you are not the intended
recipient, please telephone or email the sender and delete this message and any
attachment from your system. Unauthorized publication, use, dissemination,
forwarding, printing or copying of this e-mail and its associated attachments
is strictly prohibited.
Index: source/src/libtracker-common/tracker-file-utils.c
===================================================================
--- source/src/libtracker-common/tracker-file-utils.c (révision 3508)
+++ source/src/libtracker-common/tracker-file-utils.c (copie de travail)
@@ -623,7 +623,7 @@
return writable;
}
-static gboolean
+gboolean
path_has_write_access_or_was_created (const gchar *path)
{
gboolean writable;
@@ -673,8 +673,14 @@
return TRUE;
}
+ user_data_dir = g_getenv ("HOME");
+
+ if (!user_data_dir) {
+ user_data_dir = g_get_home_dir ();
+ }
+
/* Change environment, this is actually what we have on Ubuntu. */
- new_dir = g_build_path (G_DIR_SEPARATOR_S, g_get_home_dir (), ".local", "share", NULL);
+ new_dir = g_build_path (G_DIR_SEPARATOR_S, user_data_dir, ".local", "share", NULL);
/* Check the new XDG_DATA_HOME location */
success = g_setenv ("XDG_DATA_HOME", new_dir, TRUE);
Index: source/src/libtracker-common/tracker-file-utils.h
===================================================================
--- source/src/libtracker-common/tracker-file-utils.h (révision 3508)
+++ source/src/libtracker-common/tracker-file-utils.h (copie de travail)
@@ -49,6 +49,7 @@
const gchar *basename_exception_prefix);
gchar * tracker_path_evaluate_name (const gchar *uri);
+gboolean path_has_write_access_or_was_created (const gchar *path);
gboolean tracker_env_check_xdg_dirs (void);
gboolean tracker_file_lock (GFile *file);
Index: source/src/tracker-control/tracker-control.c
===================================================================
--- source/src/tracker-control/tracker-control.c (révision 3508)
+++ source/src/tracker-control/tracker-control.c (copie de travail)
@@ -372,7 +372,7 @@
GFile *file;
TrackerCrawler *crawler;
const gchar *suffix = ".cfg";
- const gchar *home_dir;
+ const gchar *home_conf_dir;
gchar *path;
crawler = tracker_crawler_new ();
@@ -386,13 +386,24 @@
main_loop);
/* Go through service files */
- home_dir = g_getenv ("HOME");
+
- if (!home_dir) {
- home_dir = g_get_home_dir ();
+ /* Check the default XDG_DATA_HOME location */
+ home_conf_dir = g_getenv ("XDG_CONFIG_HOME");
+
+ if (home_conf_dir && path_has_write_access_or_was_created (home_conf_dir)) {
+ path = g_build_path (G_DIR_SEPARATOR_S, home_conf_dir, "tracker", NULL);
+ } else {
+
+ home_conf_dir = g_getenv ("HOME");
+
+ if (!home_conf_dir) {
+ home_conf_dir = g_get_home_dir ();
+ }
+ path = g_build_path (G_DIR_SEPARATOR_S, home_conf_dir, ".config", "tracker", NULL);
}
- path = g_build_path (G_DIR_SEPARATOR_S, home_dir, ".config", "tracker", NULL);
+
file = g_file_new_for_path (path);
g_free (path);
_______________________________________________
tracker-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/tracker-list