2019-07-22 21:01:44 +01:00
|
|
|
diff --git a/src/portal-impl.c b/src/portal-impl.c
|
|
|
|
index 4fd48ff..346da7c 100644
|
|
|
|
--- a/src/portal-impl.c
|
|
|
|
+++ b/src/portal-impl.c
|
|
|
|
@@ -116,38 +116,50 @@ sort_impl_by_name (gconstpointer a,
|
|
|
|
void
|
|
|
|
load_installed_portals (gboolean opt_verbose)
|
2018-02-13 01:09:51 +00:00
|
|
|
{
|
2019-07-22 21:01:44 +01:00
|
|
|
- const char *portal_dir = DATADIR "/xdg-desktop-portal/portals";
|
2018-02-13 01:09:51 +00:00
|
|
|
- g_autoptr(GFile) dir = g_file_new_for_path (portal_dir);
|
|
|
|
- g_autoptr(GFileEnumerator) enumerator = NULL;
|
|
|
|
|
|
|
|
- enumerator = g_file_enumerate_children (dir, "*", G_FILE_QUERY_INFO_NONE, NULL, NULL);
|
|
|
|
+ g_auto(GStrv) portal_dir_list;
|
|
|
|
+ int i;
|
|
|
|
+ const char *portal_dir = g_getenv ("XDG_DESKTOP_PORTAL_PATH");
|
|
|
|
+
|
|
|
|
+ if (portal_dir == NULL)
|
2019-07-22 21:01:44 +01:00
|
|
|
+ portal_dir = DATADIR "/portals";
|
2018-02-13 01:09:51 +00:00
|
|
|
|
|
|
|
- if (enumerator == NULL)
|
|
|
|
- return;
|
|
|
|
+ portal_dir_list = g_strsplit (portal_dir, G_SEARCHPATH_SEPARATOR_S, 0);
|
|
|
|
|
|
|
|
- while (TRUE)
|
|
|
|
+ for (i = 0; portal_dir_list[i] != NULL; i++)
|
|
|
|
{
|
|
|
|
- g_autoptr(GFileInfo) info = g_file_enumerator_next_file (enumerator, NULL, NULL);
|
|
|
|
- g_autoptr(GFile) child = NULL;
|
|
|
|
- g_autofree char *path = NULL;
|
|
|
|
- const char *name;
|
|
|
|
- g_autoptr(GError) error = NULL;
|
|
|
|
+ portal_dir = portal_dir_list[i];
|
|
|
|
+ g_autoptr(GFile) dir = g_file_new_for_path (portal_dir);
|
|
|
|
+ g_autoptr(GFileEnumerator) enumerator = NULL;
|
|
|
|
+ enumerator = g_file_enumerate_children (dir, "*", G_FILE_QUERY_INFO_NONE, NULL, NULL);
|
|
|
|
|
|
|
|
- if (info == NULL)
|
|
|
|
- break;
|
|
|
|
+ if (enumerator == NULL)
|
|
|
|
+ continue;
|
|
|
|
|
|
|
|
- name = g_file_info_get_name (info);
|
|
|
|
+ while (TRUE)
|
|
|
|
+ {
|
|
|
|
+ g_autoptr(GFileInfo) info = g_file_enumerator_next_file (enumerator, NULL, NULL);
|
|
|
|
+ g_autoptr(GFile) child = NULL;
|
|
|
|
+ g_autofree char *path = NULL;
|
|
|
|
+ const char *name;
|
|
|
|
+ g_autoptr(GError) error = NULL;
|
|
|
|
|
|
|
|
- if (!g_str_has_suffix (name, ".portal"))
|
|
|
|
- continue;
|
|
|
|
+ if (info == NULL)
|
|
|
|
+ break;
|
|
|
|
|
|
|
|
- child = g_file_enumerator_get_child (enumerator, info);
|
|
|
|
- path = g_file_get_path (child);
|
|
|
|
+ name = g_file_info_get_name (info);
|
|
|
|
|
2019-07-22 21:01:44 +01:00
|
|
|
- if (!register_portal (path, opt_verbose, &error))
|
2018-02-13 01:09:51 +00:00
|
|
|
- {
|
|
|
|
- g_warning ("Error loading %s: %s", path, error->message);
|
|
|
|
- continue;
|
|
|
|
+ if (!g_str_has_suffix (name, ".portal"))
|
|
|
|
+ continue;
|
|
|
|
+
|
|
|
|
+ child = g_file_enumerator_get_child (enumerator, info);
|
|
|
|
+ path = g_file_get_path (child);
|
|
|
|
+
|
2019-07-22 21:01:44 +01:00
|
|
|
+ if (!register_portal (path, opt_verbose, &error))
|
2018-02-13 01:09:51 +00:00
|
|
|
+ {
|
|
|
|
+ g_warning ("Error loading %s: %s", path, error->message);
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|