[GRASS-dev] grass location creation

Jachym Cepicky jachym.cepicky at gmail.com
Fri Mar 9 03:09:31 EST 2007


Hi:

general/g.region/cmd/main.c:

851         if (flag.savedefault->answer)
852             if (strcmp(G_mapset(),"PERMANENT") == 0)
853                 G__put_window( &window, "../PERMANENT", "DEFAULT_WIND" );
854             else
855                 G_warning(_("You are not in mapset PERMANENT,
default region    -> remains untached"));

is it sufficient?

Jachym

2007/3/9, Paul Kelly <paul-grass at stjohnspoint.co.uk>:
> Hello Jachym
>
> On Thu, 8 Mar 2007, Jachym Cepicky wrote:
>
> > Thanks, Glynn, worked perfect
> >
> > Patch commited
>
> Is there a check that the mapset is PERMANENT? It should fail with an
> error if the new flag is specified and the mapset isn't PERMANENT, like I
> *think* g.proj -c without location= specified does and like I *think*
> Helena also suggested?
>
> This is really important functionality to have - good that we're finally
> getting round to adding it ;)
>
> Paul
>
> >
> > jachym
> >
> > 2007/3/8, Glynn Clements <glynn at gclements.plus.com>:
> >>
> >> Jachym Cepicky wrote:
> >>
> >> > patch for g.region is part of this email
> >> >
> >> > however, it does not work :-( I took the code from r.in.gdal (main.c
> >> > arround lines 526-546), everything looks good.. but it does not work
> >> > :-(
> >>
> >> > +        if (flag.savedefault->answer) {
> >> > +            char *location = G_location_path();
> >> > +            char *path = (char *) G_malloc(sizeof(location)+64);
> >> > +            strcpy(path,location);
> >> > +            strcat(path,"/PERMANENT/");
> >> > +            G__put_window( &window, path, "DEFAULT_WIND" );
> >> > +        }
> >>
> >> The second argument to G__put_window has to be an "element", i.e. a
> >> directory in the current mapset. r.in.gdal uses "../PERMANENT", which
> >> works because the element is simply concatenated onto the path to the
> >> mapset directory.
> >>
> >> I suggest that you adopt the same approach, i.e.:
> >>
> >>         G__put_window( &window, "../PERMANENT", "DEFAULT_WIND" );
> >>
> >> --
> >> Glynn Clements <glynn at gclements.plus.com>
> >>
> >
> >
> > --
> > Jachym Cepicky
> > e-mail: jachym.cepicky gmail com
> > URL: http://les-ejk.cz
> > GPG: http://www.les-ejk.cz/pgp/jachym_cepicky-gpg.pub
> >
> > _______________________________________________
> > grass-dev mailing list
> > grass-dev at grass.itc.it
> > http://grass.itc.it/mailman/listinfo/grass-dev
> >
>


-- 
Jachym Cepicky
e-mail: jachym.cepicky gmail com
URL: http://les-ejk.cz
GPG: http://www.les-ejk.cz/pgp/jachym_cepicky-gpg.pub




More information about the grass-dev mailing list