Skip to content
Permalink
Browse files

[processing] improve temp file names generation

  • Loading branch information
alexbruy committed Nov 12, 2016
1 parent b6d5f35 commit dff239c2416de5532d89b03be739a76937965ab5
Showing with 7 additions and 5 deletions.
  1. +7 −5 python/plugins/processing/tools/system.py
@@ -31,6 +31,7 @@
import time
import sys
import uuid
import math

from qgis.PyQt.QtCore import QDir
from qgis.core import QgsApplication
@@ -81,13 +82,14 @@ def setTempOutput(out, alg):


def getTempFilename(ext=None):
path = tempFolder()
tmpPath = tempFolder()
t = time.time()
m = math.floor(t)
uid = '{:8x}{:05x}'.format(m, int((t - m) * 1000000))
if ext is None:
filename = path + os.sep + str(time.time()) \
+ str(getNumExportedLayers())
filename = os.path.join(tmpPath, '{}{}'.format(uid, getNumExportedLayers()))
else:
filename = path + os.sep + str(time.time()) \
+ str(getNumExportedLayers()) + '.' + ext
filename = os.path.join(tmpPath, '{}{}.{}'.format(uid, getNumExportedLayers(), ext))
return filename


0 comments on commit dff239c

Please sign in to comment.
You can’t perform that action at this time.