On Wed, 24 Oct 2007, Glynn Clements wrote:

[...]
Suggested fix (untested):

char * G_basename(char *filename, const char *desired_ext)
{
   /* Find the last . in the filename */
   char *dot = strrchr(filename, '.');

   if (dot && G_strcasecmp(dot + 1, desired_ext) == 0)
      *dot = '\0';

   return filename;
}

That would break the way it is used in r.out.tiff in some circumstances.
I'm thinking it might be easier to conditionalise its use in G_parser()
and G_set_program_name() on __MINGW32__ as its only purpose there is to
strip out the .exe executable extension on Windows?

Maybe there should be two functions though. Or maybe stripping out the
.exe is quite simple and it doesn't need to use G_basename()?

If noone else has fixed this yet I'll try and get to it fairly soon.

I suggest fixing G_basename() as above; the current behaviour is
counter-intuitive and undesirable in most cases.

r.out.tiff should check for .tif and .tiff separately. This isn't just
a matter of being able to use G_basename() for other purposes.
r.out.tiff shouldn't treat anything other than .tif or .tiff (modulo
case) as a TIFF extension; cf. "area.around.Tifton_GA".

I agree; have committed changes to G_basename() and r.out.tiff accordingly. Hopefully the db.execute problem should be fixed now.

Paul

_______________________________________________
grass-dev mailing list
grass-dev@grass.itc.it
http://grass.itc.it/mailman/listinfo/grass-dev

Reply via email to