mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-25 00:58:06 -05:00
[processing] improve temp file names generation
This commit is contained in:
parent
b6d5f35be2
commit
dff239c241
@ -31,6 +31,7 @@ import os
|
||||
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
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user