[gnome-builder] projects: reuse project-file if directory
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] projects: reuse project-file if directory
- Date: Sat, 23 Mar 2019 00:02:37 +0000 (UTC)
commit 4cde078c6d8ccab4a1186c458f29e3f8a6b9f14d
Author: Christian Hergert <chergert redhat com>
Date: Fri Mar 22 17:00:33 2019 -0700
projects: reuse project-file if directory
If the project-file is a directory, and no directory was
specified in the recent-data, then re-use the project-file as
the directory.
This should fix an issue where ~/Projects is being loaded for
the project directory instead of the actual project directory.
Related #858
src/libide/projects/ide-recent-projects.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
---
diff --git a/src/libide/projects/ide-recent-projects.c b/src/libide/projects/ide-recent-projects.c
index a151494b7..12c77111b 100644
--- a/src/libide/projects/ide-recent-projects.c
+++ b/src/libide/projects/ide-recent-projects.c
@@ -195,7 +195,16 @@ ide_recent_projects_load_recent (IdeRecentProjects *self)
}
if (diruri == NULL)
- directory = g_file_get_parent (project_file);
+ {
+ /* If the old project was a plain-ol'-directory, then we don't want
+ * it's parent (which might be ~/Projects), instead reuse the project
+ * file as the directory too.
+ */
+ if (g_file_query_file_type (project_file, 0, NULL) == G_FILE_TYPE_DIRECTORY)
+ directory = g_file_dup (project_file);
+ else
+ directory = g_file_get_parent (project_file);
+ }
else
directory = g_file_new_for_uri (diruri);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]