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

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Jun 12 14:40:42 PDT 2015


Author: martinl
Date: 2015-06-12 14:40:42 -0700 (Fri, 12 Jun 2015)
New Revision: 65453

Modified:
   grass/trunk/lib/gis/open.c
Log:
libgis: construct path after the mapset has been determined


Modified: grass/trunk/lib/gis/open.c
===================================================================
--- grass/trunk/lib/gis/open.c	2015-06-12 21:19:22 UTC (rev 65452)
+++ grass/trunk/lib/gis/open.c	2015-06-12 21:40:42 UTC (rev 65453)
@@ -61,11 +61,6 @@
 
     is_tmp = (element && strncmp(element, ".tmp", 3) == 0);
 
-    if (is_tmp)
-        G_file_name_tmp(path, element, name, mapset);
-    else
-        G_file_name(path, element, name, mapset);
-
     /* READ */
     if (mode == 0) {
 	if (G_name_is_fully_qualified(name, xname, xmapset)) {
@@ -86,6 +81,9 @@
 
             G_file_name(path, element, name, mapset);
         }
+        else {
+            G_file_name_tmp(path, element, name, mapset);
+        }
         
 	if ((fd = open(path, 0)) < 0)
 	    G_warning(_("G__open(read): Unable to open '%s': %s"),
@@ -107,6 +105,11 @@
 	if (*name && G_legal_filename(name) == -1)
 	    return -1;
 
+        if (!is_tmp)
+            G_file_name(path, element, name, mapset);
+        else
+            G_file_name_tmp(path, element, name, mapset);
+        
 	if (mode == 1 || access(path, 0) != 0) {
             if (is_tmp)
                 G_make_mapset_element_tmp(element);



More information about the grass-commit mailing list