[GRASS-SVN] r65701 - grass-addons/grass7/vector/v.import

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Jul 20 05:45:23 PDT 2015


Author: martinl
Date: 2015-07-20 05:45:22 -0700 (Mon, 20 Jul 2015)
New Revision: 65701

Modified:
   grass-addons/grass7/vector/v.import/v.import.py
Log:
v.import: improve overwrite check

Modified: grass-addons/grass7/vector/v.import/v.import.py
===================================================================
--- grass-addons/grass7/vector/v.import/v.import.py	2015-07-20 11:47:11 UTC (rev 65700)
+++ grass-addons/grass7/vector/v.import/v.import.py	2015-07-20 12:45:22 UTC (rev 65701)
@@ -204,10 +204,12 @@
     
     # switch to target location
     os.environ['GISRC'] = str(tgtgisrc)
+
+    # check if map exists
+    if not grass.overwrite() and \
+       grass.find_file(output, element='vector', mapset='.')['mapset']:
+        grass.fatal(_("option <%s>: <%s> exists.") % ('output', output))
     
-    if grass.find_file(output, element='vector', mapset='.'):
-        grass.fatal(_("option <%s>: <%s> exists.") % ('output', output))
-        
     if options['extents'] == 'region':
         grass.run_command('g.remove', type = 'vector', name = vreg,
                           flags = 'f', quiet = True)



More information about the grass-commit mailing list