[GRASS-user] g.manual tries to run C:\Program Files\Internet Exporer\iexplore (the 'L' is missing from 'Explorer')

Colin Nielsen colin.nielsen at gmail.com
Tue Jul 28 09:11:55 EDT 2009


The variable's value should point to a browser's exe, not the
index.html of the docs folder.

Given that, more odd behaviour of g.manual re the variable. When
running wingrass through an msys terminal (r37101)

The following all worked
export GRASS_HTML_BROWSER="c:\Program Files\Internet Explorer\iexplore.exe"
export GRASS_HTML_BROWSER=c:/Program\ Files/Internet\ Explorer/iexplore.exe
export GRASS_HTML_BROWSER=/c/Program\ Files/Internet\ Explorer/iexplore.exe
export GRASS_HTML_BROWSER="c:\Programs\Firefox\firefox.exe"
export GRASS_HTML_BROWSER="/c/Programs/Firefox/firefox.exe"

Except that it didn't release my terminal until iexplore.exe was
closed. This was not true when firefox was used instead, the terminal
was released without closing the program. (nb. on my system firefox is
in a directory without spaces but this shouldn't be the problem).

These failed:
export GRASS_HTML_BROWSER=/c/Program Files/Internet Explorer/iexplore.exe
export GRASS_HTML_BROWSER=c:\Program Files\Internet
Explorer\iexplore.exe (no quotes)
export GRASS_HTML_BROWSER=c:\Programs\Firefox\firefox.exe
("c:ProgramsFirefoxfirefox.exe: command not found")
export GRASS_HTML_BROWSER="file:///c/Program Files/Internet
Explorer/iexplore.exe"
export GRASS_HTML_BROWSER="/c/Program\ Files/Internet\ Explorer/iexplore.exe"
export GRASS_HTML_BROWSER="c:/Program\ Files/Internet\
Explorer/iexplore.exe" (c:/Program\ Files/Internet\
Explorer/iexplore.exe: No such file or directory)
export GRASS_HTML_BROWSER="\c\Program Files\Internet
Explorer\iexplore.exe" (not surprisingly)

This all seems very inconsistent, but in summary for msys:
1) URLs don't work
2) Regular windows paths are fine as long as they are in quotes
3) Unix paths are fine as long as they're not in quotes (unless there
are no spaces, then its ok) and use backslash on spaces.

However, for osgeo4w (non-msys) by putting the following in the
etc/ini/grass.bat:
This worked (though it didn't work above):
set GRASS_HTML_BROWSER=/c/Program Files/Internet Explorer/iexplore.exe

These did not work:
set GRASS_HTML_BROWSER="c:\Program Files\Internet Explorer\iexplore.exe"
set GRASS_HTML_BROWSER="c:\PROGRA~1\INTERN~1\iexplore.exe"
set GRASS_HTML_BROWSER=c:\PROGRA~1\INTERN~1\iexplore.exe
set GRASS_HTML_BROWSER=c:/Program\ Files/Internet\ Explorer/iexplore.exe
set GRASS_HTML_BROWSER=/c/Program\ Files/Internet\ Explorer/iexplore.exe

In sum, only a unix path with no quotes or space escapes will work.
This path format does not work in msys. There is no path format that I
found that works in both, clearly a problem.

> 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"
>
If you use "cmd /k" instead of "cmd /c" it should return the terminal
without having to terminate the command.
>
> 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.

I put the above into a batch file and it worked with the URL format,
unix and windows, but g.manual wouldn't run with this batch file with
it set as the value for GRASS_HTML_BROWSER

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

Ahh this clears up the firefox exception above. However, when tested
on iexplore, it opens a new instance instead of adding it as a tab and
so won't return until that instance is closed.

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

I agree with Glynn, this is definitely the way to go if it can be
figured out since it would be better to use the user's preference,
already set in windows, for opening URLs. It worked on Vista, but only
by calling the batch file myself, not when it was set as the value of
GRASS_HTML_BROWSER. Perhaps because the g.manual script looks for an
exe specifically...

-Colin


More information about the grass-user mailing list