[gnome-builder] recent: check for project directories outside of home



commit 5e934323895cf4bd28cd1de19408c79f7bc0b439
Author: Christian Hergert <chergert redhat com>
Date:   Thu Jun 25 11:28:53 2020 -0700

    recent: check for project directories outside of home
    
    Fixes #1246

 src/plugins/recent/gbp-recent-workbench-addin.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)
---
diff --git a/src/plugins/recent/gbp-recent-workbench-addin.c b/src/plugins/recent/gbp-recent-workbench-addin.c
index 262fa5bd6..e432acc9e 100644
--- a/src/plugins/recent/gbp-recent-workbench-addin.c
+++ b/src/plugins/recent/gbp-recent-workbench-addin.c
@@ -55,15 +55,23 @@ directory_is_ignored (GFile *file)
       !g_file_has_prefix (file, projects_dir))
     return TRUE;
 
+  /* First check downloads directory as we never want that */
   downloads_dir = g_file_new_for_path (g_get_user_special_dir (G_USER_DIRECTORY_DOWNLOAD));
-
   if (downloads_dir != NULL &&
       (g_file_equal (file, downloads_dir) ||
        g_file_has_prefix (file, downloads_dir)))
     return TRUE;
 
-  /* realtive_path should be valid here because we are within the home_prefix. */
-  g_assert (relative_path != NULL);
+  /* If the directory is in the projects dir (and the projects dir is
+   * not $HOME, then short-circuit as not ignored.
+   */
+  if (!g_file_equal (home_dir, projects_dir) &&
+      g_file_has_prefix (file, projects_dir))
+    return FALSE;
+
+  /* Not in home or projects directory, ignore */
+  if (relative_path == NULL)
+    return TRUE;
 
   /*
    * Ignore dot directories, except .local.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]