Insert DATADIR into the default XDG_DATA_DIRS

This commit is contained in:
Pierre Pronchery 2017-12-07 19:06:20 +01:00
parent 69c22237a4
commit 45d2afff26

View File

@ -33,6 +33,13 @@
#include <string.h> #include <string.h>
#include "Desktop.h" #include "Desktop.h"
#ifndef PREFIX
# define PREFIX "/usr/local"
#endif
#ifndef DATADIR
# define DATADIR PREFIX "/share"
#endif
/* private */ /* private */
/* constants */ /* constants */
@ -269,7 +276,7 @@ int mimehandler_load_by_name(MimeHandler * handler, String const * name)
return ret; return ret;
/* read through every XDG application folder */ /* read through every XDG application folder */
if((path = getenv("XDG_DATA_DIRS")) == NULL || strlen(path) == 0) if((path = getenv("XDG_DATA_DIRS")) == NULL || strlen(path) == 0)
path = "/usr/local/share:/usr/share"; path = "/usr/local/share:" DATADIR ":/usr/share";
if((p = string_new(path)) == NULL) if((p = string_new(path)) == NULL)
return -1; return -1;
for(q = strtok_r(p, ":", &last); q != NULL; for(q = strtok_r(p, ":", &last); q != NULL;