diff --git a/app/flatpak-main.c b/app/flatpak-main.c index e49d0a10..8558f367 100644 --- a/app/flatpak-main.c +++ b/app/flatpak-main.c @@ -49,6 +49,7 @@ static gboolean opt_version; static gboolean opt_default_arch; static gboolean opt_supported_arches; static gboolean opt_gl_drivers; +static gboolean opt_list_installations; static gboolean opt_user; static gboolean opt_system; static char **opt_installations; @@ -160,6 +161,7 @@ static GOptionEntry empty_entries[] = { { "default-arch", 0, 0, G_OPTION_ARG_NONE, &opt_default_arch, N_("Print default arch and exit"), NULL }, { "supported-arches", 0, 0, G_OPTION_ARG_NONE, &opt_supported_arches, N_("Print supported arches and exit"), NULL }, { "gl-drivers", 0, 0, G_OPTION_ARG_NONE, &opt_gl_drivers, N_("Print active gl drivers and exit"), NULL }, + { "installations", 0, 0, G_OPTION_ARG_NONE, &opt_list_installations, N_("Print paths for system installations and exit"), NULL }, { NULL } }; @@ -308,6 +310,27 @@ flatpak_option_context_parse (GOptionContext *context, exit (EXIT_SUCCESS); } + if (opt_list_installations) + { + GPtrArray *paths; + g_autoptr(GError) error = NULL; + guint i; + + paths = flatpak_get_system_base_dir_locations (NULL, &error); + if (!paths) + return FALSE; + + for (i = 0; i < paths->len; i++) + { + GFile *file = paths->pdata[i]; + g_autofree char *path; + + path = g_file_get_path (file); + g_print ("%s\n", path); + } + exit (EXIT_SUCCESS); + } + if (opt_verbose > 0 || opt_ostree_verbose) flatpak_disable_fancy_output ();