Browse Source

vlib: fix GRASS_VECTOR_TMPDIR_MAPSET when opening existing map

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@66779 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 9 years ago
parent
commit
18b92b8d6d
1 changed files with 12 additions and 2 deletions
  1. 12 2
      lib/vector/Vlib/open.c

+ 12 - 2
lib/vector/Vlib/open.c

@@ -255,8 +255,18 @@ int Vect__open_old(struct Map_info *Map, const char *name, const char *mapset,
             }
 
             Vect__get_element_path(file_path, Map, GV_HEAD_ELEMENT);
-            if (access(file_path, F_OK) != 0)
-                return -1;
+            if (access(file_path, F_OK) != 0) {
+                /* unable to find header file for temporary map, try
+                 * to switch to normal mode, useful when updating
+                 * existing map */
+                Map->temporary = FALSE;
+                Vect__get_path(path, Map); /* path must be updated for
+                                            * subsequent operations */
+                Vect__get_element_path(file_path, Map, GV_HEAD_ELEMENT);
+                if (access(file_path, F_OK) != 0)
+                    return -1;
+
+            }
         }
     }