Commit d69b8d5d authored by Jeroen Vreeken's avatar Jeroen Vreeken
Browse files

First check for config files in /etc/dt/

parent 8b23083a
......@@ -29,17 +29,20 @@ static bool init_done = false;
static int load_config(void)
{
GKeyFile *keyfile;
gboolean loaded;
gchar *keyfilename = "dt_host.ini";
gboolean loaded = false;
gchar *keyfilename[] ={ "/etc/dt/dt_host.ini", "dt_host.ini" };
int ret = 0;
int i;
keyfile = g_key_file_new();
loaded = g_key_file_load_from_file(
keyfile,
keyfilename,
G_KEY_FILE_NONE,
NULL);
for (i = 0; i < sizeof(keyfilename)/sizeof(keyfilename[0]) && !loaded; i++) {
loaded = g_key_file_load_from_file(
keyfile,
keyfilename[i],
G_KEY_FILE_NONE,
NULL);
}
if (loaded) {
gsize groups_nr;
......
......@@ -58,8 +58,8 @@ int cmd_port = CONSOLE_DT_MODEL_CMD_PORT;
static int load_ini(void)
{
GKeyFile *keyfile;
gboolean loaded;
gchar *keyfilename = "dt_model.ini";
gboolean loaded = false;
gchar *keyfilename[] = { "/etc/dt/dt_model.ini", "dt_model.ini" };
int ret = 0;
int i;
char *active_name = "none";
......@@ -67,11 +67,13 @@ static int load_ini(void)
keyfile = g_key_file_new();
loaded = g_key_file_load_from_file(
keyfile,
keyfilename,
G_KEY_FILE_KEEP_COMMENTS,
NULL);
for (i = 0; i < sizeof(keyfilename)/sizeof(keyfilename[0]) && !loaded; i++) {
loaded = g_key_file_load_from_file(
keyfile,
keyfilename[i],
G_KEY_FILE_KEEP_COMMENTS,
NULL);
}
if (loaded) {
gsize groups_nr;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment