[GRASS-dev] Windows-style Pathnames

Glynn Clements glynn at gclements.plus.com
Tue Nov 7 23:14:49 EST 2006


Paul Kelly wrote:

> >>> So, if we were to add ".sh" extensions to all of the scripts, and
> >>> add ".sh" to PATHEXT, calling e.g. system("r.out.gdal ...") should
> >>> run r.out.gdal.sh using the program associated with ".sh" in the
> >>> registry.
> >
> > I hope this is done in the windows build process (like "gcc -o
> > ${module}.exe", and not for all platforms. i.e. "g.script" works from
> > the command line on all platforms without having to type ".sh" in unix.
> 
> Yes it would just be Windows-specific like .exe is already added to 
> executable modules in Windows. Shouldn't be hard to do at all and then we 
> just need to provide instructions to people on how to set up the file 
> association, or maybe that can be done some scriptable way?

You can do this using the "assoc" and "ftype" commands (these are
built in to cmd.exe rather than separate programs) . However, there
appears to be more to this than what I can find in Microsoft's
documentation.

The assoc and ftype commands affect the keys in HKEY_CLASSES_ROOT
(which is synthesised by merging HKEY_LOCAL_MACHINE\Software\Classes
and HKEY_CURRENT_USER\Software\Classes). However, experimentation
suggests that:

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\<ext>\Application

is used if that is set. It's quite possible that other "desktop"
settings may also affect the process. My guess is that assoc/ftype
will be sufficient if the user doesn't have any existing settings for
the extension. If they do, all bets are off; I wouldn't count on the
precise behaviour being documented anywhere.

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




More information about the grass-dev mailing list