Переглянути джерело

vlib: fix opening temporary vector maps (when `mapset == ""`)

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@57470 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 11 роки тому
батько
коміт
953a861244
1 змінених файлів з 9 додано та 3 видалено
  1. 9 3
      lib/vector/Vlib/open.c

+ 9 - 3
lib/vector/Vlib/open.c

@@ -241,9 +241,15 @@ int Vect__open_old(struct Map_info *Map, const char *name, const char *mapset,
         else {
             char file_path[GPATH_MAX];
             
-            if (strcmp(Map->mapset, G_mapset()) != 0) {
-                G_warning(_("Temporary vector maps can be accessed only in the current mapset"));
-                return -1;
+            /* temporary map: reduce to current mapset if search path
+             * was set */
+            if (strcmp(Map->mapset, "") == 0)
+                Map->mapset = G_store(G_mapset());
+            else {
+                if (strcmp(Map->mapset, G_mapset()) != 0) {
+                    G_warning(_("Temporary vector maps can be accessed only in the current mapset"));
+                    return -1;
+                }
             }
             G_file_name(file_path, path, GV_HEAD_ELEMENT, Map->mapset);
             if (access(file_path, F_OK) != 0)