[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
Tue Jul 28 10:52:28 EDT 2009


Colin Nielsen wrote:

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

This is down to the "export" command terminating the value at the
first space.

> export GRASS_HTML_BROWSER=c:\Programs\Firefox\firefox.exe
> ("c:ProgramsFirefoxfirefox.exe: command not found")

This is down to the shell interpreting the \ character.

Both of the above issues go away if you use single quotes, e.g.:

	export 'GRASS_HTML_BROWSER=c:\Programs\Firefox\firefox.exe'

Note that I'm not concerned with the syntax for specifying the
variable's value, but the syntax of its arguments.

> 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

Windows' "set" command treats everything after the = as the value,
regardless of any spaces, whereas bash's "export" command terminates
the value at the first unquoted/unescaped space.

As for the /c/... syntax, that will work if $GRASS_HTML_BROWSER is
being used in a bash script (e.g. g.manual), but won't work natively.

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

The "set" command will treat any quotes literally, as part of the
variable's value.

> set GRASS_HTML_BROWSER=c:\PROGRA~1\INTERN~1\iexplore.exe

I suspect that this is a case of the setting setting being "correct"
rather than MSys-compatible.

> set GRASS_HTML_BROWSER=c:/Program\ Files/Internet\ Explorer/iexplore.exe
> set GRASS_HTML_BROWSER=/c/Program\ Files/Internet\ Explorer/iexplore.exe

Forward slashes and MSys' /c/... syntax won't work in Windows' command
interpreter. MSys' bash will convert filename syntax if it recognises
it as such.

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

Indeed. This is why we're giving up on MSys for GRASS 7. It's
impossible to specify filenames which will work both in both MSys and
elsewhere.

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

Can you modify the script to print its arguments? And g.manual to
print out $GRASS_HTML_BROWSER.

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-dev mailing list