mirror of
https://github.com/flatpak/flatpak.git
synced 2026-03-13 04:32:12 -04:00
Avoid confusing behavior of flatpak info
I have multiple branches of org.gnome.Platform install system-wide, and non per-user. And flatpak info gives me: flatpak info org.gnome.Platform -> not installed flatpak info --system org.gnome.Platform -> multiple branches This confusing behavior comes from the fact that we are querying multiple locations and are not careful enough to collate the errors we get properly. This commit changes things so that we keep querying the next location as long as we get a 'not installed' error, and we report the first 'multiple branches' error we get.
This commit is contained in:
committed by
Alexander Larsson
parent
581e6f6df5
commit
ee54e2b099
@@ -132,6 +132,7 @@ flatpak_find_installed_pref (const char *pref, FlatpakKinds kinds, const char *d
|
||||
if (search_user || search_all)
|
||||
{
|
||||
user_dir = flatpak_dir_get_user ();
|
||||
|
||||
ref = flatpak_dir_find_installed_ref (user_dir,
|
||||
id,
|
||||
branch,
|
||||
@@ -140,6 +141,12 @@ flatpak_find_installed_pref (const char *pref, FlatpakKinds kinds, const char *d
|
||||
&lookup_error);
|
||||
if (ref)
|
||||
dir = user_dir;
|
||||
|
||||
if (g_error_matches (lookup_error, G_IO_ERROR, G_IO_ERROR_FAILED))
|
||||
{
|
||||
g_propagate_error (error, g_steal_pointer (&lookup_error));
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (ref == NULL && search_all)
|
||||
@@ -153,17 +160,26 @@ flatpak_find_installed_pref (const char *pref, FlatpakKinds kinds, const char *d
|
||||
for (i = 0; i < system_dirs->len; i++)
|
||||
{
|
||||
FlatpakDir *system_dir = g_ptr_array_index (system_dirs, i);
|
||||
|
||||
g_clear_error (&lookup_error);
|
||||
|
||||
ref = flatpak_dir_find_installed_ref (system_dir,
|
||||
id,
|
||||
branch,
|
||||
arch,
|
||||
kinds, &kind,
|
||||
lookup_error == NULL ? &lookup_error : NULL);
|
||||
&lookup_error);
|
||||
if (ref)
|
||||
{
|
||||
dir = system_dir;
|
||||
break;
|
||||
}
|
||||
|
||||
if (g_error_matches (lookup_error, G_IO_ERROR, G_IO_ERROR_FAILED))
|
||||
{
|
||||
g_propagate_error (error, g_steal_pointer (&lookup_error));
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -182,17 +198,25 @@ flatpak_find_installed_pref (const char *pref, FlatpakKinds kinds, const char *d
|
||||
|
||||
if (installation_dir)
|
||||
{
|
||||
g_clear_error (&lookup_error);
|
||||
|
||||
ref = flatpak_dir_find_installed_ref (installation_dir,
|
||||
id,
|
||||
branch,
|
||||
arch,
|
||||
kinds, &kind,
|
||||
lookup_error == NULL ? &lookup_error : NULL);
|
||||
&lookup_error);
|
||||
if (ref)
|
||||
{
|
||||
dir = installation_dir;
|
||||
break;
|
||||
}
|
||||
|
||||
if (g_error_matches (lookup_error, G_IO_ERROR, G_IO_ERROR_FAILED))
|
||||
{
|
||||
g_propagate_error (error, g_steal_pointer (&lookup_error));
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -200,12 +224,16 @@ flatpak_find_installed_pref (const char *pref, FlatpakKinds kinds, const char *d
|
||||
if (ref == NULL && search_system)
|
||||
{
|
||||
system_dir = flatpak_dir_get_system_default ();
|
||||
|
||||
g_clear_error (&lookup_error);
|
||||
|
||||
ref = flatpak_dir_find_installed_ref (system_dir,
|
||||
id,
|
||||
branch,
|
||||
arch,
|
||||
kinds, &kind,
|
||||
lookup_error == NULL ? &lookup_error : NULL);
|
||||
&lookup_error);
|
||||
|
||||
if (ref)
|
||||
dir = system_dir;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user