aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortlatorre <tlatorre@uchicago.edu>2019-06-06 13:13:08 -0500
committertlatorre <tlatorre@uchicago.edu>2019-06-06 13:13:08 -0500
commita556c94c1eaffedd2fa1d6ccd73061ab9402cdc0 (patch)
tree55cdb10b1706236010bba9fb7a5e853dbf58dc4a /src
parent9f6454e3f3923a61d1f480d4e1b0303aeeefe7b3 (diff)
downloadsddm-a556c94c1eaffedd2fa1d6ccd73061ab9402cdc0.tar.gz
sddm-a556c94c1eaffedd2fa1d6ccd73061ab9402cdc0.tar.bz2
sddm-a556c94c1eaffedd2fa1d6ccd73061ab9402cdc0.zip
update find_file() to use the environment variable DQXX_DIR
Diffstat (limited to 'src')
-rw-r--r--src/util.c11
1 files changed, 10 insertions, 1 deletions
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;
}