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,8 +623,8 @@ return writable; } -static gboolean -path_has_write_access_or_was_created (const gchar *path) +gboolean +tracker_path_has_write_access_or_was_created (const gchar *path) { gboolean writable; gboolean exists = FALSE; @@ -669,19 +669,25 @@ /* Check the default XDG_DATA_HOME location */ g_message (" XDG_DATA_HOME is '%s'", user_data_dir); - if (user_data_dir && path_has_write_access_or_was_created (user_data_dir)) { + if (user_data_dir && tracker_path_has_write_access_or_was_created (user_data_dir)) { return TRUE; } + user_data_dir = g_getenv ("HOME"); + + if ( (!user_data_dir) || (!tracker_path_has_write_access_or_was_created (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); if (success) { g_message (" XDG_DATA_HOME set to '%s'", new_dir); - success = path_has_write_access_or_was_created (new_dir); + success = tracker_path_has_write_access_or_was_created (new_dir); } else { g_message (" XDG_DATA_HOME could not be set"); } 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 tracker_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 && tracker_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) || (!tracker_path_has_write_access_or_was_created (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);