Skip to content

Commit

Permalink
[sextante] fixed problem when exporting non-file based data to be use…
Browse files Browse the repository at this point in the history
…d by 3rd party apps
  • Loading branch information
volaya committed Apr 17, 2013
1 parent cf8f8c3 commit 06d2045
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions python/plugins/sextante/core/LayerExporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,18 @@ def exportVectorLayer(layer):
It also export to a new file if the original one contains non-ascii characters'''
settings = QSettings()
systemEncoding = settings.value( "/UI/encoding", "System" ).toString()

filename = os.path.basename(unicode(layer.source()))
idx = filename.rfind(".")
if idx != -1:
filename = filename[:idx]
output = SextanteUtils.getTempFilenameInTempFolder(filename + ".shp")
#output = SextanteUtils.getTempFilename("shp")

filename = str(layer.name())
validChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789:"
filename = ''.join(c for c in filename if c in validChars)
if len(filename) == 0:
filename = "layer"
output = SextanteUtils.getTempFilenameInTempFolder(filename + ".shp")
provider = layer.dataProvider()
useSelection = SextanteConfig.getSetting(SextanteConfig.USE_SELECTED)
if useSelection and layer.selectedFeatureCount() != 0:
Expand Down

0 comments on commit 06d2045

Please sign in to comment.