mirror of
https://github.com/flatpak/flatpak.git
synced 2026-04-04 07:11:28 -04:00
Improve handling of FLATPAK_BUILTIN_FLAG_ONE_DIR
Error out for all combinations of options that specify more than one installations. This was showing up e.g. with flatpak config --installation=extra --system --get languages Closes: #2511 Approved by: mwleeds
This commit is contained in:
committed by
Atomic Bot
parent
c39ceac02e
commit
d9982d8550
@@ -375,15 +375,19 @@ flatpak_option_context_parse (GOptionContext *context,
|
||||
{
|
||||
FlatpakDir *dir;
|
||||
|
||||
if ((opt_system && opt_user) ||
|
||||
(opt_system && opt_installations != NULL) ||
|
||||
(opt_user && opt_installations != NULL) ||
|
||||
(opt_installations != NULL && opt_installations[1] != NULL))
|
||||
return usage_error (context, _("Multiple installations specified for a command "
|
||||
"that works on one installation"), error);
|
||||
|
||||
if (opt_system || (!opt_user && opt_installations == NULL))
|
||||
dir = flatpak_dir_get_system_default ();
|
||||
else if (opt_user)
|
||||
dir = flatpak_dir_get_user ();
|
||||
else if (opt_installations != NULL)
|
||||
{
|
||||
if (g_strv_length (opt_installations) > 1)
|
||||
return usage_error (context, _("The --installation option was used multiple times "
|
||||
"for a command that works on one installation"), error);
|
||||
dir = flatpak_dir_get_system_by_id (opt_installations[0], cancellable, error);
|
||||
if (dir == NULL)
|
||||
return FALSE;
|
||||
|
||||
Reference in New Issue
Block a user