diff options
author | Cosimo Cecchi <cosimo@endlessm.com> | 2014-12-09 18:06:11 -0800 |
---|---|---|
committer | Cosimo Cecchi <cosimoc@gnome.org> | 2014-12-10 09:09:02 -0800 |
commit | 5f06c134f4f6da02027c813322e13c220b51cd0a (patch) | |
tree | 0c793ddb41303a660b44495338cf7f69ec2c4264 /src | |
parent | 2888747bdba45011b14fe0daac3025d75b3f5ad0 (diff) | |
download | tracker-5f06c134f4f6da02027c813322e13c220b51cd0a.tar.gz |
miner-fs: use GFile to check for homedir
Instead of a simple path comparison. This will work with relative paths,
double slashes and similar scenarios, since the path will be
fully-canonicalized by GIO before comparison.
The price to pay is recursively indexing the home directory, so we'd
better be extra careful...
https://bugzilla.gnome.org/show_bug.cgi?id=741317
Diffstat (limited to 'src')
-rw-r--r-- | src/miners/fs/tracker-config.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/miners/fs/tracker-config.c b/src/miners/fs/tracker-config.c index 733caa66e..b297dfd22 100644 --- a/src/miners/fs/tracker-config.c +++ b/src/miners/fs/tracker-config.c @@ -528,10 +528,18 @@ static gchar * get_user_special_dir_if_not_home (GUserDirectory directory) { const gchar *path; + GFile *home, *file; + gboolean res; path = g_get_user_special_dir (directory); + file = g_file_new_for_path (path); + home = g_file_new_for_path (g_get_home_dir ()); - if (g_strcmp0 (path, g_get_home_dir ()) == 0) { + res = g_file_equal (file, home); + g_object_unref (file); + g_object_unref (home); + + if (res) { /* ignore XDG directories set to $HOME */ return NULL; } else { |