diff --git a/src/shell-app-cache.c b/src/shell-app-cache.c index 15d4734d0..9b33c7ac2 100644 --- a/src/shell-app-cache.c +++ b/src/shell-app-cache.c @@ -109,11 +109,17 @@ load_folder (GHashTable *folders, while ((name = g_dir_read_name (dir))) { + g_autofree gchar *stripped_name = NULL; g_autofree gchar *filename = NULL; g_autoptr(GKeyFile) keyfile = NULL; + if (!g_str_has_suffix (name, ".directory")) + continue; + + stripped_name = g_strndup (name, strlen (name) - strlen (".directory")); + /* First added wins */ - if (g_hash_table_contains (folders, name)) + if (g_hash_table_contains (folders, stripped_name)) continue; filename = g_build_filename (path, name, NULL); @@ -128,7 +134,8 @@ load_folder (GHashTable *folders, NULL, NULL); if (translated != NULL) - g_hash_table_insert (folders, g_strdup (name), translated); + g_hash_table_insert (folders, g_steal_pointer (&stripped_name), + translated); } } }