[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: gEDA-user: [PATCH] Write logs to $HOME/.gEDA/logs/.



On Sun, 2009-01-18 at 01:49 +0000, Peter Clifton wrote:
> On Sun, 2009-01-18 at 01:10 +0000, Peter TB Brett wrote:
> > On Sunday 18 January 2009 01:07:13 Bob Paddock wrote:
> > > > I'd appreciate comments as to whether this will work (or even compile)
> > > > on Windows!
> > >
> > > +  dir_path = g_build_filename (g_getenv ("HOME"),
> > > +                               ".gEDA", "logs", NULL);
> > >
> > > Should test to see if HOME really exists on Windows,
> > > it usually doesn't by default.  You don't want to report
> > > the failure of HOME not existing in the log during
> > > the install process.
> > >
> > 
> > What should it do if HOME doesn't exist? That seems like a pathological case. 
> > Default to using the CWD?
> 
> No, we need to handle it via various fallbacks. There are I believe GLib
> routines to find the dir we want.

grep for g_get_home_dir() in the existing sources.

Note that to retain Unixy semantics about honouring $HOME in the first
instance, you need to try the "HOME" environment variable first. In
their wisdom, the glib developers choose the home dir specified in
the /etc/passwd file in preference to $HOME.

libgeda/src/g_rc.c:

gint g_rc_parse_home_rc(TOPLEVEL *toplevel, const gchar *rcname)
{
 
[snip]

  home = g_getenv ("HOME");
  if (home == NULL)
     home = g_get_home_dir ();

  if (home == NULL) {
    return 0;
  }

  tmp = g_build_filename (home, ".gEDA", rcname, NULL);

[snip]


This is "better", but its still not quite the right place to put things
on Win32 if you were aiming for a more native place.

-- 
Peter Clifton

Electrical Engineering Division,
Engineering Department,
University of Cambridge,
9, JJ Thomson Avenue,
Cambridge
CB3 0FA

Tel: +44 (0)7729 980173 - (No signal in the lab!)



_______________________________________________
geda-user mailing list
geda-user@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user