Skip to content

Commit

Permalink
[processing] use original filename when possible when exporting vecto…
Browse files Browse the repository at this point in the history
…r layer

Conflicts:
	python/plugins/processing/tools/dataobjects.py
  • Loading branch information
volaya committed Oct 5, 2016
1 parent c65cc92 commit a968fa3
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions python/plugins/processing/tools/dataobjects.py
Expand Up @@ -47,6 +47,7 @@
from processing.algs.gdal.GdalUtils import GdalUtils
from processing.tools.system import (getTempFilenameInTempFolder,
getTempFilename,
removeInvalidChars
isWindows)

ALL_TYPES = [-1]
Expand Down Expand Up @@ -311,6 +312,13 @@ def exportVectorLayer(layer, supported=None):
systemEncoding = settings.value('/UI/encoding', 'System')

output = getTempFilename('shp')
basename = removeInvalidChars(os.path.basename(layer.source()))
if basename:
if not basename.endswith("shp"):
basename = basename + ".shp"
output = getTempFilenameInTempFolder(basename)
else:
output = getTempFilename("shp")
provider = layer.dataProvider()
useSelection = ProcessingConfig.getSetting(ProcessingConfig.USE_SELECTED)
if useSelection and layer.selectedFeatureCount() != 0:
Expand Down

0 comments on commit a968fa3

Please sign in to comment.