[GRASS-dev] patch - allows g.mapset to create mapsets
glynn at gclements.plus.com
Mon Oct 23 11:21:33 EDT 2006
Joel Pitt wrote:
> Hi all,
> As per the discussion with Hamish from last week, I've created a patch
> to g.mapset that allows mapsets to be created if they don't exist.
> User has to specify the flag '-c' to enable this behaviour.
> I implemented this behaviour by creating a G_make_mapset function in
> the gis library.
> Attached is a tar.gz containing the patch for files include/gisdefs.h
> and general/g.mapset/main.c (gmapset.diff) and and a new file with the
> new function (lib/gis/make_mapset.c)
> Hopefully someone has time to review and add this to CVS.
/* Make the mapset. */
sprintf( path, "%s/%s/%s", gisdbase_name, location_name, mapset_name );
if( mkdir( path, 0775 ) != 0 )
The mkdir() call should use mode 0777; the user's umask setting will
affect the actual permissions.
In general, directories should use 0777, files should use either 0777
(if they are executable) or 0666 (if they are not). The user can
always remove permissions through their umask setting, but can't add
permissions (other than manually running chmod).
/* Copy default window/regions to new mapset */
G__put_window( &default_window, "", "DEFAULT_WIND" );
G__put_window( &default_window, "", "WIND" );
Normal mapsets don't have a DEFAULT_WIND file; only the PERMANENT
mapset has that. IOW, DEFAULT_WIND is a property of a location rather
than a mapset.
Glynn Clements <glynn at gclements.plus.com>
More information about the grass-dev