After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 764701 - projects-directory: save absolute path
projects-directory: save absolute path
Status: RESOLVED FIXED
Product: gnome-builder
Classification: Other
Component: preferences
3.20.x
Other Linux
: Normal normal
: ---
Assigned To: GNOME Builder Maintainers
GNOME Builder Maintainers
Depends on:
Blocks:
 
 
Reported: 2016-04-06 22:48 UTC by Akshaya Kakkilaya
Modified: 2016-04-18 03:31 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
using absolute path (4.57 KB, patch)
2016-04-06 22:48 UTC, Akshaya Kakkilaya
none Details | Review
using absolute path(modified) (4.62 KB, patch)
2016-04-07 06:05 UTC, Akshaya Kakkilaya
committed Details | Review

Description Akshaya Kakkilaya 2016-04-06 22:48:20 UTC
Created attachment 325509 [details] [review]
using absolute path

saving relative path with respective to home directory using g_file_get_relative_path() causes critical warnings when choosing directories outside home directory.
Comment 1 Christian Hergert 2016-04-06 23:32:56 UTC
Review of attachment 325509 [details] [review]:

Couple quick style changes

::: libide/preferences/ide-preferences-file-chooser-button.c
@@ -82,2 +77,2 @@
     {
-      path = g_build_filename (g_get_home_dir (), folder, NULL);
+      if (file [0] != '/')

Use !g_path_is_absolute (file)

@@ -83,2 +78,4 @@
-      path = g_build_filename (g_get_home_dir (), folder, NULL);
-      gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (self->widget), path);
+      if (file [0] != '/')
+        path = g_build_filename (g_get_home_dir (), file, NULL);
+      else
+        path = g_strdup (file);

path = g_steal_pointer (&file);

::: plugins/create-project/gbp-create-project-widget.c
@@ +341,3 @@
   if (!ide_str_empty0 (path))
     {
+      if (path[0] != '/')

g_path_is_absolute here too

@@ -343,1 +343,4 @@
-      projects_dir = g_build_filename (g_get_home_dir (), path, NULL);
+      if (path[0] != '/')
+        projects_dir = g_build_filename (g_get_home_dir (), path, NULL);
+      else
+        projects_dir = g_strdup (path);

g_steal_pointer (&path) here too

::: plugins/git/ide-git-clone-widget.c
@@ +206,3 @@
   if (!ide_str_empty0 (path))
     {
+      if (path [0] != '/')

Same

@@ +209,3 @@
+        projects_dir = g_build_filename (g_get_home_dir (), path, NULL);
+      else
+        projects_dir = g_strdup (path);

Same
Comment 2 Akshaya Kakkilaya 2016-04-07 06:05:43 UTC
Created attachment 325519 [details] [review]
using absolute path(modified)
Comment 3 Christian Hergert 2016-04-18 03:29:56 UTC
Review of attachment 325519 [details] [review]:

LGTM
Comment 4 Christian Hergert 2016-04-18 03:31:12 UTC
Thanks for fixing this!