diff --git a/include/macros.h b/include/macros.h index 56f3fb3..9915636 100644 --- a/include/macros.h +++ b/include/macros.h @@ -1,6 +1,11 @@ #ifndef MACROSH_ #define MACROSH_ +// More like constants but I'm not making yet another header file just for this +#ifndef LIDM_CONF_PATH + #define LIDM_CONF_PATH "/etc/lidm.ini" +#endif + // Do we just replace the compiler with clang?? #if defined(__clang__) #define NULLABLE _Nullable diff --git a/src/config.c b/src/config.c index 44a20b6..fc11b11 100644 --- a/src/config.c +++ b/src/config.c @@ -12,6 +12,7 @@ #include "config.h" #include "desktop.h" #include "log.h" +#include "macros.h" #include "util.h" #define UPPER_HALF_BYTE 4 @@ -241,9 +242,8 @@ int parse_config(struct config* NNULLABLE config, char* NNULLABLE path) { FILE* fd = fopen(path, "r"); if (fd == NULL) { log_perror("fopen"); - log_printf( - " [I] No config, place one at /etc/lidm.ini or set the LIDM_CONF " - "env variable"); + log_printf(" [I] No config, place one at " LIDM_CONF_PATH + " or set the LIDM_CONF env variable"); return 0; // Its fine now anyways } diff --git a/src/main.c b/src/main.c index db2a2e0..4a8aa29 100644 --- a/src/main.c +++ b/src/main.c @@ -75,7 +75,7 @@ int main(int argc, char* argv[]) { // Copy struct config config = DEFAULT_CONFIG; char* conf_override = getenv("LIDM_CONF"); - char* conf_path = conf_override ? conf_override : "/etc/lidm.ini"; + char* conf_path = conf_override ? conf_override : LIDM_CONF_PATH; if (parse_config(&config, conf_path) != 0) { (void)fputs("error parsing config\n", stderr); return 1;