[GRASS-dev] Re: [GRASS-user] g.manual tries to run C:\Program
Files\Internet Exporer\iexplore (the 'L' is missing from 'Explorer')
Glynn Clements
glynn at gclements.plus.com
Mon Jul 27 05:03:34 EDT 2009
Hamish wrote:
> > Could anyone clarify which of the following are valid
> > arguments to GRASS_HTML_BROWSER?
> >
> > 1. A native filename, e.g.:
> >
> > C:\GRASS\docs\html\index.html
> >
> > 2. A Unix-ish filename, e.g.:
> >
> > C:/GRASS/docs/html/index.html
>
> the above failed on ms windows, which split it into C :/ GRASS..
> and didn't know the "C" rfc protocol, and then :/ as the first
> part of :// etc.
>
> changed to be:
>
> > 3. A file: URL, e.g.:
> >
> > file:///C:/GRASS/docs/html/index.html
>
> from gis.m AFAIR.
>
> > 4. A HTTP URL, e.g.:
> >
> > http://grass.osgeo.org/
>
> I assume that would work, but I believe the goal is to have help
> available on the local computer as the software could often
> be used on a laptop for field work where no internet access is
> available.
>
>
> > It would be much easier to set GRASS_HTML_BROWSER correctly
> > if I knew how it's actually meant to be used.
>
> I expect exact argument usage is dependent on the browser you
> give for GRASS_HTML_BROWSER.
That's backwards. The user doesn't get to choose what arguments it is
passed; that's built into the software.
The user (and init scripts) need to set GRASS_HTML_BROWSER according
to what it is supposed to be capable of dealing with.
And developers need to ensure that it is only passed arguments
which match what GRASS_HTML_BROWSER is documented as supporting.
But in order to do either of those things, the semantics need to be
documented. And they aren't. AFAICT, the only documentation is (from
lib/init/variables.html):
GRASS_HTML_BROWSER
[init.sh, wxgui]
defines name of HTML browser. For most platforms this should be
an executable in your PATH, or the full path to an executable
[plus some stuff about OSX.]
Apparently it should identify "an executable". Well, that doesn't
really help much.
As it stands, any and all usage of GRASS_HTML_BROWSER is a bug. It
isn't possible to use it correctly when there's no definition of
"correct".
BTW:
AFAICT, the "right" way to open files on Windows is to simply run them
via the shell, e.g. pointing GRASS_HTML_BROWSER at a batch file
containing:
@echo off
cmd /c "%1"
This will open the file via its registered command, as if it had been
double-clicked in Explorer.
For opening URLs:
@echo off
rundll32 url.dll,OpenURL "%1"
This also appears to work with filenames, with both forward and
backward slashes. However, it returns immediately, while "cmd /c ..."
waits for the command to terminate.
When the command terminates depends upon the command. For Notepad, it
means exiting Notepad. Firefox returns once it has displayed the page
if it uses an existing instance, but waits until you exit it if it has
to start a new instance.
If we can confirm that the OpenURL approach works on most versions of
Windows, we should use that for GRASS_HTML_BROWSER rather than
iexplore.exe (particularly as init.bat currently uses a hard-coded
pathname which will typically be wrong on non-English versions of
Windows; hint: use %ProgramFiles% to get the "Program Files"
directory).
--
Glynn Clements <glynn at gclements.plus.com>
More information about the grass-dev
mailing list