From 618dab4472eaa2420cc43018e600290fd1cf1868 Mon Sep 17 00:00:00 2001 From: Pierre Pronchery Date: Thu, 19 Oct 2023 03:48:54 +0200 Subject: [PATCH] MimeHandler: do not read default XDG application folders twice --- src/mimehandler.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/mimehandler.c b/src/mimehandler.c index b36174f..d3ef25a 100644 --- a/src/mimehandler.c +++ b/src/mimehandler.c @@ -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) - path = "/usr/local/share:" DATADIR ":/usr/share"; + { + /* 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;