1
0
Fork 0
mirror of https://github.com/albfan/miraclecast.git synced 2025-03-09 23:38:56 +00:00

Ini files for miracle-wifid

Honor ~/.miraclecast or ~/.config/miraclecastrc

Properties avaliable:
- wifid: log-level
- sinkctl: external-player, rstp-port, log-level, log-journal-level, autocmd
- wifictl: log-level, journal-log-level

Command line has always higher priority over ini files

fixes #113
This commit is contained in:
albfan 2017-03-27 03:13:47 +02:00 committed by Alberto Fanjul
parent 1bc0648f4b
commit 04a1ec8aa3
10 changed files with 136 additions and 19 deletions

View file

@ -17,7 +17,7 @@ libmiracle_shared_la_SOURCES = \
util.h \
wpas.h \
wpas.c
libmiracle_shared_la_LIBADD = -lsystemd
libmiracle_shared_la_LIBADD = -lsystemd \
$(DEPS_LIBS) \
$(GLIB_LIBS)

View file

@ -31,6 +31,26 @@
#include <systemd/sd-bus.h>
#include <time.h>
#include "shl_macro.h"
#include <glib.h>
static inline GKeyFile* load_ini_file() {
GKeyFile* gkf = NULL;
gchar* config_file;
gkf = g_key_file_new();
config_file = g_build_filename(g_get_home_dir(), ".config", "miraclecastrc", NULL);
if (!g_key_file_load_from_file(gkf, config_file, G_KEY_FILE_NONE, NULL)) {
g_free(config_file);
config_file = g_build_filename(g_get_home_dir(), ".miraclecast", NULL);
if (!g_key_file_load_from_file(gkf, config_file, G_KEY_FILE_NONE, NULL)) {
g_key_file_free(gkf);
gkf = NULL;
}
}
g_free(config_file);
return gkf;
}
static inline void cleanup_sd_bus_message(sd_bus_message **ptr)
{