MimeHandler: do not read default XDG application folders twice

This commit is contained in:
Pierre Pronchery 2023-10-19 03:48:54 +02:00
parent 0055fda87f
commit 618dab4472

View File

@ -597,7 +597,13 @@ int mimehandler_load_by_name(MimeHandler * handler, String const * name)
return ret;
/* read through every XDG application folder */
if((path = getenv("XDG_DATA_DIRS")) == NULL || strlen(path) == 0)
{
/* XXX avoid duplicates if PREFIX is "/usr/local" */
if(string_compare("/usr/local/share", DATADIR) != 0)
path = "/usr/local/share:" DATADIR ":/usr/share";
else
path = "/usr/local/share:/usr/share";
}
if((p = string_new(path)) == NULL)
return -1;
for(q = strtok_r(p, ":", &last); q != NULL;