[GRASS-SVN] r35540 - in grass/branches/releasebranch_6_4:
general/g.mapsets include lib/gis
svn_grass at osgeo.org
svn_grass at osgeo.org
Thu Jan 22 14:06:49 EST 2009
Author: martinl
Date: 2009-01-22 14:06:49 -0500 (Thu, 22 Jan 2009)
New Revision: 35540
Modified:
grass/branches/releasebranch_6_4/general/g.mapsets/main_cmd.c
grass/branches/releasebranch_6_4/include/gisdefs.h
grass/branches/releasebranch_6_4/lib/gis/mapset_nme.c
Log:
attempt to fix trac #379
(merge from trunk, r35449)
Modified: grass/branches/releasebranch_6_4/general/g.mapsets/main_cmd.c
===================================================================
--- grass/branches/releasebranch_6_4/general/g.mapsets/main_cmd.c 2009-01-22 19:01:35 UTC (rev 35539)
+++ grass/branches/releasebranch_6_4/general/g.mapsets/main_cmd.c 2009-01-22 19:06:49 UTC (rev 35540)
@@ -136,6 +136,10 @@
char *mapset;
mapset = *ptr;
+
+ if (G_is_mapset_in_search_path(mapset))
+ continue;
+
if (G__mapset_permissions(mapset) < 0)
G_fatal_error(_("Mapset <%s> not found"), mapset);
else
Modified: grass/branches/releasebranch_6_4/include/gisdefs.h
===================================================================
--- grass/branches/releasebranch_6_4/include/gisdefs.h 2009-01-22 19:01:35 UTC (rev 35539)
+++ grass/branches/releasebranch_6_4/include/gisdefs.h 2009-01-22 19:06:49 UTC (rev 35540)
@@ -812,6 +812,7 @@
int G_reset_mapsets(void);
char **G_available_mapsets(void);
void G_add_mapset_to_search_path(const char *mapset);
+int G_is_mapset_in_search_path(const char *);
/* mask_info.c */
char *G_mask_info(void);
Modified: grass/branches/releasebranch_6_4/lib/gis/mapset_nme.c
===================================================================
--- grass/branches/releasebranch_6_4/lib/gis/mapset_nme.c 2009-01-22 19:01:35 UTC (rev 35539)
+++ grass/branches/releasebranch_6_4/lib/gis/mapset_nme.c 2009-01-22 19:06:49 UTC (rev 35540)
@@ -218,11 +218,25 @@
*/
void G_add_mapset_to_search_path(const char *mapset)
{
+ if (!G_is_mapset_in_search_path(mapset))
+ new_mapset(mapset);
+}
+
+/*!
+ \brief Check if given mapset is in search path
+
+ \param mapset mapset name
+
+ \return 1 mapset found in search path
+ \return 0 mapset not found
+*/
+int G_is_mapset_in_search_path(const char *mapset)
+{
int i;
for (i = 0; i < nmapset; i++) {
if (strcmp(mapset_name[i], mapset) == 0)
- return;
+ return 1;
}
- new_mapset(mapset);
+ return 0;
}
More information about the grass-commit
mailing list