forked from Mirrors/flatpak-builder
Ignore system installations configured with a duplicated ID
If a system installation with the same ID than the one being considered has been added, print a warning and ignore.tingping/wmclass
parent
a663e5ba73
commit
7962d4d145
|
@ -280,6 +280,23 @@ parse_storage_type (const char *type_string)
|
|||
return FLATPAK_DIR_STORAGE_TYPE_DEFAULT;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
has_system_location (GPtrArray *locations,
|
||||
const char *id)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < locations->len; i++)
|
||||
{
|
||||
GFile *path = g_ptr_array_index (locations, i);
|
||||
DirExtraData *extra_data = g_object_get_data (G_OBJECT (path), "extra-data");
|
||||
if (extra_data != NULL && g_strcmp0 (extra_data->id, id) == 0)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
append_locations_from_config_file (GPtrArray *locations,
|
||||
const char *file_path,
|
||||
|
@ -322,6 +339,12 @@ append_locations_from_config_file (GPtrArray *locations,
|
|||
if (len > 0)
|
||||
id[len - 1] = '\0';
|
||||
|
||||
if (has_system_location (locations, id))
|
||||
{
|
||||
g_warning ("Found duplicate flatpak installation (Id: %s). Ignoring", id);
|
||||
continue;
|
||||
}
|
||||
|
||||
path = g_key_file_get_string (keyfile, groups[i], "Path", &my_error);
|
||||
if (path == NULL)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue