瀏覽代碼

libgis: construct path after the mapset has been determined

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@65453 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 10 年之前
父節點
當前提交
ac845cf713
共有 1 個文件被更改,包括 8 次插入5 次删除
  1. 8 5
      lib/gis/open.c

+ 8 - 5
lib/gis/open.c

@@ -61,11 +61,6 @@ static int G__open(const char *element,
 
     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 @@ static int G__open(const char *element,
 
             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 @@ static int G__open(const char *element,
 	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);