[gnome-builder] projects: alter project id based on directory status



commit 100206fd771603ab469bc324f39f8917b1055928
Author: Christian Hergert <chergert redhat com>
Date:   Thu Jan 31 14:24:52 2019 -0800

    projects: alter project id based on directory status
    
    This isn't ideal in that we do I/O here, but it improves the quality of
    the results and we basically require local projects anyway for things
    to really work.

 src/libide/projects/ide-project-info.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/src/libide/projects/ide-project-info.c b/src/libide/projects/ide-project-info.c
index 547d1d450..252f8743a 100644
--- a/src/libide/projects/ide-project-info.c
+++ b/src/libide/projects/ide-project-info.c
@@ -794,8 +794,13 @@ ide_project_info_get_id (IdeProjectInfo *self)
 
   if (!self->id && self->file)
     {
-      g_autoptr(GFile) parent = g_file_get_parent (self->file);
-      self->id = g_file_get_basename (parent);
+      if (g_file_query_file_type (self->file, 0, NULL) == G_FILE_TYPE_DIRECTORY)
+        self->id = g_file_get_basename (self->file);
+      else
+        {
+          g_autoptr(GFile) parent = g_file_get_parent (self->file);
+          self->id = g_file_get_basename (parent);
+        }
     }
 
   if (!self->id && self->doap)


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