[GRASS-dev] Windows-style Pathnames
Paul Kelly
paul-grass at stjohnspoint.co.uk
Tue Nov 7 14:19:43 EST 2006
On Tue, 7 Nov 2006, Hamish wrote:
> Paul Kelly wrote:
>> Yes. The way I've done that in the is first to pass the string
>> containing the path to G_convert_dirseps_to_host(), which will
>> replace all occurences of / by \, and then quote the path name with
>> \"escaped double quotes\" within the argument supplied to system() -
>> I think this should cover both eventualities of the pathname
>> containing spaces, *and* the backslashes possibly being
>> misinterpreted by a shell. Although as we've seen it should normally
>> by cmd.exe invoked for this.
>
> does it check/strip existing " before adding new ones?
The function doesn't add " characters - they were just added in the
argument passed to the system() function. I wouldn't expect any filename
strings being passed around to already contain " characters?
> Glynn:
>>> 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?
More information about the grass-dev
mailing list