/[graveman]/graveman/current/src/config.c
ViewVC logotype

Diff of /graveman/current/src/config.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.34 by scresto, Sun Apr 17 21:56:06 2005 UTC revision 1.35 by scresto, Sun Apr 17 22:39:53 2005 UTC
# Line 296  GSList *get_data_path() Line 296  GSList *get_data_path()
296  {  {
297    GSList *Lnewlist = NULL;    GSList *Lnewlist = NULL;
298    const gchar *Lenv;    const gchar *Lenv;
299    gchar Lpath[MAXPATHLEN];    gchar *Lpath;
300    gchar **Llistpath;    gchar **Llistpath;
301    gint i;    gint i;
302    
303      /* parametre -c sur la ligne de commande */
304      if ((Lpath = param_get_string("data_file"))) {
305        Llistpath = g_strsplit(Lpath, ":", 0);
306    
307        for (i=0; Llistpath[i]; i++) {
308          if (!*Llistpath[i]) continue; /* on ignore les entrees vides */
309          Lnewlist = g_slist_append(Lnewlist, g_strdup_printf(Llistpath[i]));
310        }
311    
312        g_strfreev(Llistpath);
313      }
314    
315    if ((Lenv=g_getenv("XDG_DATA_HOME"))) {    if ((Lenv=g_getenv("XDG_DATA_HOME"))) {
316      g_strdup_printf(Lpath, sizeof(Lpath)-1, "%s/%s/%s.conf", Lenv, PACKAGE, PACKAGE);      Lpath = g_strdup_printf("%s/%s", Lenv, PACKAGE);
317      Lnewlist = g_slist_append(Lnewlist, Lpath);      Lnewlist = g_slist_append(Lnewlist, Lpath);
318    } else if ((Lenv=g_getenv("HOME"))) {    } else if ((Lenv=g_getenv("HOME"))) {
319      g_strdup_printf(Lpath, sizeof(Lpath)-1, "%s/.local/share/%s/%s.conf", Lenv, PACKAGE, PACKAGE);      Lpath = g_strdup_printf("%s/.local/share/%s", Lenv, PACKAGE);
320      Lnewlist = g_slist_append(Lnewlist, Lpath);      Lnewlist = g_slist_append(Lnewlist, Lpath);
321    }    }
322    
# Line 312  GSList *get_data_path() Line 324  GSList *get_data_path()
324      Llistpath = g_strsplit(Lenv, ":", 0);      Llistpath = g_strsplit(Lenv, ":", 0);
325    
326      for (i=0; Llistpath[i]; i++) {      for (i=0; Llistpath[i]; i++) {
327        g_strdup_printf(Lpath, sizeof(Lpath)-1, "%s/%s/%s.conf", Llistpath[i], PACKAGE, PACKAGE);        Lpath = g_strdup_printf("%s/%s/%s.conf", Llistpath[i], PACKAGE, PACKAGE);
328        Lnewlist = g_slist_append(Lnewlist, Lpath);        Lnewlist = g_slist_append(Lnewlist, Lpath);
329      }      }
330    
331      g_strfreev(Llistpath);      g_strfreev(Llistpath);
332    } else {    } else {
333      g_snprintf(Lpath, sizeof(Lpath)-1, "/usr/local/share/%s", PACKAGE);      Lpath = g_strdup_printf("/usr/local/share/%s", PACKAGE);
334      Lnewlist = g_slist_append(Lnewlist, Lpath);      Lnewlist = g_slist_append(Lnewlist, Lpath);
335      g_snprintf(Lpath, sizeof(Lpath)-1, "/usr/share/%s", PACKAGE);      Lpath = g_strdup_printf("/usr/share/%s", PACKAGE);
336      Lnewlist = g_slist_append(Lnewlist, Lpath);      Lnewlist = g_slist_append(Lnewlist, Lpath);
337    }    }
338    

Legend:
Removed from v.1.34  
changed lines
  Added in v.1.35

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26