From a556c94c1eaffedd2fa1d6ccd73061ab9402cdc0 Mon Sep 17 00:00:00 2001 From: tlatorre Date: Thu, 6 Jun 2019 13:13:08 -0500 Subject: update find_file() to use the environment variable DQXX_DIR --- src/util.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/util.c b/src/util.c index 0a67e59..4230911 100644 --- a/src/util.c +++ b/src/util.c @@ -32,7 +32,8 @@ FILE *open_file(const char *filename, const char *mode) } /* Returns the full path to `filename` by searching the current working - * directory and the path specified by the environment variable SDDM_DATA. + * directory and the path specified by the environment variables SDDM_DATA and + * DQXX_DIR. * * Returns a pointer to the full path on success or NULL if the file isn't * found. */ @@ -53,5 +54,13 @@ char *find_file(const char *filename) if (access(path, F_OK) == 0) return path; } + /* Now check in the directory specified by the environment variable + * DQXX_DIR. */ + dir = getenv("DQXX_DIR"); + if (dir) { + sprintf(path, "%s/%s", dir,filename); + if (access(path, F_OK) == 0) return path; + } + return NULL; } -- cgit