]> git.pld-linux.org Git - packages/gcombust.git/blob - gcombust-home_etc.patch
- updated gettext BR
[packages/gcombust.git] / gcombust-home_etc.patch
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
4 @@ -40,7 +40,7 @@
5  /* I expect to need to write to several config files, might as well use
6   * a whole dir for gcombust */
7  
8 -#define GCOMBUST_CONFIG_DIR ".gcombust"
9 +#define GCOMBUST_CONFIG_DIR "gcombust"
10  #define GCOMBUST_CONFIG_FILE_NAME "gcombustrc"
11  
12  static void read_env(void) {
13 @@ -96,23 +96,29 @@
14         }
15  }
16  
17 -static char *get_config_dir(void) {
18 +static char *get_config_dir(int i) {
19         char *config_dir, *config;
20  
21         if (NULL == (config_dir = getenv("HOME")))
22                 config_dir = ".";
23  
24         config = string_append(config_dir, NULL);
25 -       config = string_append(config, "/");
26 +       if (i==0)
27 +                 config = string_append(config, "/.");
28 +       else {
29 +                 config = string_append(config, "/etc");
30 +                 mkdir (config, 0700);
31 +                 config = string_append(config, "/");
32 +       }
33         config = string_append(config, GCOMBUST_CONFIG_DIR);
34  
35         return config;
36  }
37  
38 -static char *get_config_file(void) {
39 +static char *get_config_file(int i) {
40         char *config;
41  
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);
46  
47 @@ -264,8 +270,10 @@
48         if (NULL == cdda2wav_path)
49                 cdda2wav_path = which("cdda2wav");
50  
51 -       config = get_config_file();
52 -
53 +       config = get_config_file(1);
54 +       if (NULL == (fp = fopen(config, "r"))) {
55 +               config = get_config_file(0);
56 +       }
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"
60 @@ -307,11 +315,11 @@
61         char *config;
62         int i;
63  
64 -       config = get_config_dir();
65 +       config = get_config_dir(1);
66         mkdir(config, S_IRWXU | S_IRWXG);
67         free(config);
68  
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"));
73                 free(config);
This page took 0.055382 seconds and 3 git commands to generate.