bug-gnubg
[Top][All Lists]
Advanced

[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: Holger
Subject: Re: [Bug-gnubg] Bug when opening from file icon a match saved in .sgf
Date: Sun, 12 Oct 2003 23:51:56 +0200

On Sun, 12 Oct 2003 19:05:12 +0000, 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

There are environment variables that can be read. I think for the
"program files"-folder it's just %Program Files% (in Windows notation;
I suppose we could obtain it with getenv( "Program Files" );). There
is also one for "own documents/preferences", but I don't remember
right now how it's called.

But I'm not sure about the existence on all versions of Windows! E.g.
Win95 seems not to know this.

> > > work if installed in the default suggested directory? Is it somehow

Yes. I've installed gnubg e.g. on M:\games\gnubg. So this is no viable
solution.

> > > possible to find out where gnubg was installed?

If information about the installation folder of gnubg is stored then
this is of course possible.

> > > 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)

Where exactly? The only occurrence I've found was generated by (and
for) Inno Setup. But it could be used nevertheless.

> > But you can also set (and read) an environment variable.
> > DOS command:
> > SET xyz=[value]

Sure, but not recommendable. On DOS based systems (Win9x) this takes
away more or less precious lower memory.

> > I would opt for the second choice, although the WinPro(g)s will say:
> > No way. Use that Registry!!
> 
> I'd opt for the registry, unless it's possible by the installer to add
> the environment variable to the list of system env. variables.

I agree. Btw, adding an env. variable differs a lot between the
various Windows versions.

> It shouldn't be that difficult to query the registry (or am I just being
> naïve)?

There shouldn't be any need that we do that manually. Windows should
do this association. And at least on my system it seems to work
(except for starting gnubg in a different language than set in Windows
preferences; program options aren't yet evaluated when .gnubgautorc is
looked for in order to set gnubg's language, should be possible to fix
by moving this code to just after the first getopt_long loop).

I can just double click on any .sgf file in Windows explorer and a new
gnubg instance opens with this match. (If an already open gnubg ought
to open that file, I suppose we have to use DDE. This is some
communication mechanism between Windows and an application where
Windows sends a so called verb with an action request. But this
requires a program designed for this.)

Here are the relevant registry keys from my machine (Win95, but that
shouldn't matter):
gnubg.reg:
---8<----
REGEDIT4

[HKEY_CLASSES_ROOT\GNUBackgammon]
@="Smart Game Format"

[HKEY_CLASSES_ROOT\GNUBackgammon\DefaultIcon]
@="M:\\Games\\GNUbg\\gnubg.exe,0"

[HKEY_CLASSES_ROOT\GNUBackgammon\shell]

[HKEY_CLASSES_ROOT\GNUBackgammon\shell\open]

[HKEY_CLASSES_ROOT\GNUBackgammon\shell\open\command]
@="\"M:\\Games\\GNUbg\\gnubg.exe\" --datadir \"M:\\Games\\GNUbg\"
\"%1\""
---8<----

I'm not sure whether Oystein's installer creates those keys in exactly
this way. I think I've adjusted mine manually when we had this
discussion long ago.

Regards,

        Holger




reply via email to

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