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.
Cheers
--
-Joel
"Wish not to seem, but to be, the best."
-- Aeschylus
Attached file this time.
On 10/23/06, Joel Pitt <joel.pitt@gmail.com> 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.
Cheers
--
-Joel
"Wish not to seem, but to be, the best."
-- Aeschylus
--
-Joel
"Wish not to seem, but to be, the best."
-- Aeschylus
(attachments)
gmapsetcreate.tar.gz (2.44 KB)
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 )
return -1;
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@gclements.plus.com>
On 10/24/06, Glynn Clements <glynn@gclements.plus.com> wrote:
Joel Pitt wrote:
/* Make the mapset. */
sprintf( path, "%s/%s/%s", gisdbase_name, location_name, mapset_name );
if( mkdir( path, 0775 ) != 0 )
return -1;
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.
Updated with permissions 0777 and removed the call to add DEFAULT_WIND
to the new mapset.
Cheers
--
-Joel
"Wish not to seem, but to be, the best."
-- Aeschylus
(attachments)
gmapsetcreate.tar.gz (3.35 KB)
Joel Pitt wrote:
> /* Make the mapset. */
> sprintf( path, "%s/%s/%s", gisdbase_name, location_name, mapset_name );
> if( mkdir( path, 0775 ) != 0 )
> return -1;
>
> 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.
Updated with permissions 0777 and removed the call to add DEFAULT_WIND
to the new mapset.
The attachment contains the wrong file: make_loc.c rather than
make_mapset.c.
--
Glynn Clements <glynn@gclements.plus.com>
Sorry, have attached tar with correct file, make_mapset instead.
On 10/27/06, Glynn Clements <glynn@gclements.plus.com> wrote:
Joel Pitt wrote:
> > /* Make the mapset. */
> > sprintf( path, "%s/%s/%s", gisdbase_name, location_name, mapset_name );
> > if( mkdir( path, 0775 ) != 0 )
> > return -1;
> >
> > 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.
>
> Updated with permissions 0777 and removed the call to add DEFAULT_WIND
> to the new mapset.
The attachment contains the wrong file: make_loc.c rather than
make_mapset.c.
--
Glynn Clements <glynn@gclements.plus.com>
--
-Joel
"Wish not to seem, but to be, the best."
-- Aeschylus
(attachments)
gmapsetcreate.tar.gz (2.41 KB)
Joel Pitt wrote:
Sorry, have attached tar with correct file, make_mapset instead.
Committed to CVS.
--
Glynn Clements <glynn@gclements.plus.com>
Hi,
I am unable to compile lib/init/mke_loc.c, to use mkdir function I
have to add sys/stat.h header to mke_loc.c (on Debian GNU/Linux
unstable).
Best regards, Martin
2006/10/27, Glynn Clements <glynn@gclements.plus.com>:
Joel Pitt wrote:
> Sorry, have attached tar with correct file, make_mapset instead.
Committed to CVS.
--
Glynn Clements <glynn@gclements.plus.com>
_______________________________________________
grass-dev mailing list
grass-dev@grass.itc.it
http://grass.itc.it/mailman/listinfo/grass-dev
--
Martin Landa <landa.martin@gmail.com> * http://gama.fsv.cvut.cz/~landa *
Martin Landa wrote:
I am unable to compile lib/init/mke_loc.c, to use mkdir function I
have to add sys/stat.h header to mke_loc.c (on Debian GNU/Linux
unstable).
Fixed in CVS.
BTW, this problem isn't related to Joel's patch which is being
discussed in this thread, but to my patch in the thread:
Re: [bug #5218] (grass) wingrass: creating new location from startup screen with projection values fails
etc/set_data (from lib/init) has its own code for creating the
location/mapset directories; it doesn't use the libgis functions.
--
Glynn Clements <glynn@gclements.plus.com>