[GRASS-SVN] r35449 - in grass/trunk: general/g.mapsets include
lib/gis
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri Jan 16 17:27:23 EST 2009
Author: martinl
Date: 2009-01-16 17:27:22 -0500 (Fri, 16 Jan 2009)
New Revision: 35449
Modified:
grass/trunk/general/g.mapsets/main.c
grass/trunk/include/gisdefs.h
grass/trunk/lib/gis/mapset_nme.c
Log:
attempt to fix trac #379
Modified: grass/trunk/general/g.mapsets/main.c
===================================================================
--- grass/trunk/general/g.mapsets/main.c 2009-01-16 22:14:50 UTC (rev 35448)
+++ grass/trunk/general/g.mapsets/main.c 2009-01-16 22:27:22 UTC (rev 35449)
@@ -150,6 +150,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/trunk/include/gisdefs.h
===================================================================
--- grass/trunk/include/gisdefs.h 2009-01-16 22:14:50 UTC (rev 35448)
+++ grass/trunk/include/gisdefs.h 2009-01-16 22:27:22 UTC (rev 35449)
@@ -759,6 +759,7 @@
void G_reset_mapsets(void);
char **G_available_mapsets(void);
void G_add_mapset_to_search_path(const char *);
+int G_is_mapset_in_search_path(const char *);
/* mask_info.c */
char *G_mask_info(void);
Modified: grass/trunk/lib/gis/mapset_nme.c
===================================================================
--- grass/trunk/lib/gis/mapset_nme.c 2009-01-16 22:14:50 UTC (rev 35448)
+++ grass/trunk/lib/gis/mapset_nme.c 2009-01-16 22:27:22 UTC (rev 35449)
@@ -187,11 +187,26 @@
*/
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 < st->path.count; i++)
+
+ for (i = 0; i < st->path.count; i++) {
if (strcmp(st->path.names[i], mapset) == 0)
- return;
+ return 1;
+ }
- new_mapset(mapset);
+ return 0;
}
More information about the grass-commit
mailing list