1 diff -Nur gcombust-0.1.25/src/config_files.c gcombust-0.1.25-modified/src/config_files.c
2 --- gcombust-0.1.25/src/config_files.c Thu Sep 23 18:53:23 1999
3 +++ gcombust-0.1.25-modified/src/config_files.c Wed Dec 15 10:17:46 1999
5 /* I expect to need to write to several config files, might as well use
6 * a whole dir for gcombust */
8 -#define GCOMBUST_CONFIG_DIR ".gcombust"
9 +#define GCOMBUST_CONFIG_DIR "gcombust"
10 #define GCOMBUST_CONFIG_FILE_NAME "gcombustrc"
12 static void read_env(void) {
17 -static char *get_config_dir(void) {
18 +static char *get_config_dir(int i) {
19 char *config_dir, *config;
21 if (NULL == (config_dir = getenv("HOME")))
24 config = string_append(config_dir, NULL);
25 - config = string_append(config, "/");
27 + config = string_append(config, "/.");
29 + config = string_append(config, "/etc");
30 + mkdir (config, 0700);
31 + config = string_append(config, "/");
33 config = string_append(config, GCOMBUST_CONFIG_DIR);
38 -static char *get_config_file(void) {
39 +static char *get_config_file(int i) {
42 - config = get_config_dir();
43 + config = get_config_dir(i);
44 config = string_append(config, "/");
45 config = string_append(config, GCOMBUST_CONFIG_FILE_NAME);
48 if (NULL == cdda2wav_path)
49 cdda2wav_path = which("cdda2wav");
51 - config = get_config_file();
53 + config = get_config_file(1);
54 + if (NULL == (fp = fopen(config, "r"))) {
55 + config = get_config_file(0);
57 if (NULL == (fp = fopen(config, "r"))) {
58 alert_user_of_error(_(" Could not open config file.\n"
59 " Please configure gcombust in the File/Preferences menu \n"
64 - config = get_config_dir();
65 + config = get_config_dir(1);
66 mkdir(config, S_IRWXU | S_IRWXG);
69 - config = get_config_file();
70 + config = get_config_file(1);
71 if (NULL == (fp = fopen(config, "w"))) {
72 alert_user_of_error(_(" Could not open config file for writing! \n"));