[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-gnubg] Bug when opening from file icon a match saved in .sgf

From: Jim Segrave
Subject: Re: [Bug-gnubg] Bug when opening from file icon a match saved in .sgf
Date: Mon, 13 Oct 2003 18:27:53 +0200
User-agent: Mutt/1.4.1i

On Mon 13 Oct 2003 (11:46 +0100), Jon Kinsey wrote:
> At 20:05 12/10/2003, Joern Thyssen wrote:
> >On Sun, Oct 12, 2003 at 08:22:37PM +0200, Nardy Pillards wrote
> >> On 12 Oct 2003 at 16:58, Joern Thyssen wrote:
> >>
> >>
> >> > Isn't there some environment variable we can query or some function we
> >> > can call that'll return the path to "program files"? Or will this only
> >> > work if installed in the default suggested directory? Is it somehow
> >> > possible to find out where gnubg was installed?
> >> >
> >> > If possible, it should be trivial to initialise the data directory
> >> > with this value.
> >>
> >> You can read the Registry.
> >> (Installation Archive keeps the Installation Directory there)
> >>
> >> But you can also set (and read) an environment variable.
> >> DOS command:
> >> SET xyz=[value]
> >>
> >> I would opt for the second choice, although the WinPro(g)s will say:
> >> No way. Use that Registry!!

I gather that you can't use argv[0], getenv("PATH") and getcwd() to
find the path to the gnubg executable that's running?[1]  If those all
work, then it's tedious but not difficult to search for the executable 
starting with the getcwd and argv[0], then trying argv[0] appended to
each element of the path environment variable. (Special case - if
argv[0] starts from a file system root (C:\ or C:/) then you are
done. If argv[0] starts with '\' or '/', then you are done (and it's
the default drive. If argv[0] otherwise contains a directory
separator, then the executable came from cwd '\' argv[0], if all the
previous failed, try each element of the path.

[1] I know Windows/Microsoft in general never supplied the full path
    in argv[0] - under Unix, this is all a no-brainer - the install
    directory is simply argv[0] with everything after the last
    directory separator removed.

Jim Segrave           address@hidden

reply via email to

[Prev in Thread] Current Thread [Next in Thread]