[GRASS-SVN] r46173 - grass/trunk/lib/gis

svn_grass at osgeo.org svn_grass at osgeo.org
Tue May 3 15:13:05 EDT 2011


Author: glynn
Date: 2011-05-03 12:13:05 -0700 (Tue, 03 May 2011)
New Revision: 46173

Modified:
   grass/trunk/lib/gis/mapset_nme.c
Log:
Force current mapset to appear at front of mapset search path


Modified: grass/trunk/lib/gis/mapset_nme.c
===================================================================
--- grass/trunk/lib/gis/mapset_nme.c	2011-05-03 17:45:32 UTC (rev 46172)
+++ grass/trunk/lib/gis/mapset_nme.c	2011-05-03 19:13:05 UTC (rev 46173)
@@ -53,24 +53,27 @@
 void G_get_list_of_mapsets(void)
 {
     FILE *fp;
+    const char *cur;
 
     if (G_is_initialized(&st->initialized))
 	return;
 
+    cur = G_mapset();
+    new_mapset(cur);
+
     fp = G_fopen_old("", "SEARCH_PATH", G_mapset());
     if (fp) {
 	char name[GNAME_MAX];
-	while (fscanf(fp, "%s", name) == 1)
+	while (fscanf(fp, "%s", name) == 1) {
+	    if (strcmp(name, cur) == 0)
+		continue;
 	    if (G__mapset_permissions(name) >= 0)
 		new_mapset(name);
+	}
 	fclose(fp);
     }
-
-    if (!st->path.count) {
+    else {
 	static const char perm[] = "PERMANENT";
-	const char *cur = G_mapset();
-
-	new_mapset(cur);
 	if (strcmp(perm, cur) != 0 && G__mapset_permissions(perm) >= 0)
 	    new_mapset(perm);
     }



More information about the grass-commit mailing list