From 651c86d3c60cdf41e9dea2ce23cc7eb2aacb9b4f Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sun, 30 Sep 2018 14:45:13 -0400 Subject: [PATCH] run: Allow selecting an installation It may be an unlikely case, but if the same app is installed in multiple installations, there was no way to select which one to run, so far. Closes: #2146 Closes: #2158 Approved by: alexlarsson --- app/flatpak-builtins-run.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/app/flatpak-builtins-run.c b/app/flatpak-builtins-run.c index 9d3f981d..dd3d6a1e 100644 --- a/app/flatpak-builtins-run.c +++ b/app/flatpak-builtins-run.c @@ -90,6 +90,7 @@ flatpak_builtin_run (int argc, char **argv, GCancellable *cancellable, GError ** g_autofree char *branch = NULL; FlatpakKinds kinds; g_autoptr(GError) local_error = NULL; + g_autoptr(GPtrArray) dirs = NULL; context = g_option_context_new (_("APP [args...] - Run an app")); g_option_context_set_translation_domain (context, GETTEXT_PACKAGE); @@ -110,7 +111,9 @@ flatpak_builtin_run (int argc, char **argv, GCancellable *cancellable, GError ** arg_context = flatpak_context_new (); g_option_context_add_group (context, flatpak_context_get_options (arg_context)); - if (!flatpak_option_context_parse (context, options, &argc, &argv, FLATPAK_BUILTIN_FLAG_NO_DIR, NULL, cancellable, error)) + if (!flatpak_option_context_parse (context, options, &argc, &argv, + FLATPAK_BUILTIN_FLAG_ALL_DIRS, + &dirs, cancellable, error)) return FALSE; if (rest_argc == 0) @@ -146,7 +149,7 @@ flatpak_builtin_run (int argc, char **argv, GCancellable *cancellable, GError ** if (app_ref == NULL) return FALSE; - app_deploy = flatpak_find_deploy_for_ref (app_ref, opt_commit, cancellable, &local_error); + app_deploy = flatpak_find_deploy_for_ref_in (dirs, app_ref, opt_commit, cancellable, &local_error); if (app_deploy == NULL && (!g_error_matches (local_error, FLATPAK_ERROR, FLATPAK_ERROR_NOT_INSTALLED) || (kinds & FLATPAK_KINDS_RUNTIME) == 0)) @@ -168,7 +171,7 @@ flatpak_builtin_run (int argc, char **argv, GCancellable *cancellable, GError ** if (runtime_ref == NULL) return FALSE; - runtime_deploy = flatpak_find_deploy_for_ref (runtime_ref, opt_commit ? opt_commit : opt_runtime_commit, cancellable, &local_error2); + runtime_deploy = flatpak_find_deploy_for_ref_in (dirs, runtime_ref, opt_commit ? opt_commit : opt_runtime_commit, cancellable, &local_error2); if (runtime_deploy == NULL) { /* Report old app-kind error, as its more likely right */