6 #include "libsilverconf.h"
8 int load_config(struct Silver_Conf
*conf
, const char *appname
)
13 conf
->appname
= appname
;
15 char *path
= malloc(300);
16 strcpy(path
, getenv("HOME"));
17 if (stat(path
, &st
) != 0)
20 strcat(path
, "/.config");
21 if (stat(path
, &st
) != 0)
23 int res
= mkdir(path
, 0755);
27 printf("%s: Error creating directory %s. Error code: %i", appname
, path
, res
);
30 strcat(path
, "/silver/");
31 if (stat(path
, &st
) != 0)
33 int res
= mkdir(path
, 0755);
37 printf("%s: Error creating directory %s. Error code: %i", appname
, path
, res
);
40 strcat(path
, appname
);
41 if (stat(path
, &st
) != 0)
43 int res
= mkdir(path
, 0755);
47 printf("%s: Error creating directory %s. Error code: %i", appname
, path
, res
);
55 const char *get_config(struct Silver_Conf
*conf
, const char *section
, const char *key
, const char *default_value
)
57 const char *value
= default_value
;
62 void delete_config(struct Silver_Conf
*conf
)