graphics: Do not load JSON ICDs multiple times from the same dirs
When we build the search paths for the JSON ICDs it might happen to have the same directory multiple times. For example if we have "XDG_CONFIG_DIRS=/usr/share" and "XDG_DATA_DIRS=/usr/share" we will look in "/usr/share" two times and duplicate all the JSONs that we find.
Usually this is not an issue but with some games, e.g. Red Dead Redemption 2, this can cause a crash at startup https://github.com/ValveSoftware/steam-runtime/issues/336
With this commit we filter out the directories that we already visited to prevent this kind of issues.
Fixes: #48 (closed)
/cc @smcv
Edited by Ludovico de Nittis