mirror of
https://github.com/javalsai/lidm.git
synced 2025-08-30 09:58:00 +02:00
fix: necessary code changes for nix configurability
This commit is contained in:
@@ -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
|
||||
|
@@ -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
|
||||
}
|
||||
|
||||
|
@@ -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;
|
||||
|
Reference in New Issue
Block a user