Skip to content

Commit 8cb888c

Browse files
committedDec 20, 2012
use system-wide temp directory for temporary files instead of own dir in
user profile
1 parent 97812b4 commit 8cb888c

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed
 

‎python/plugins/sextante/SextantePlugin.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -110,13 +110,14 @@ def unload(self):
110110
self.menu.deleteLater()
111111
#delete temporary output files
112112
folder = SextanteUtils.tempFolder()
113-
for f in os.listdir(folder):
114-
path = os.path.join(folder,f)
115-
try:
116-
os.unlink(path)
117-
except:
118-
#leave files that could not be deleted
119-
pass
113+
if QDir(folder).exists():
114+
for f in os.listdir(folder):
115+
path = os.path.join(folder, f)
116+
try:
117+
os.unlink(path)
118+
except:
119+
#leave files that could not be deleted
120+
pass
120121

121122
def openToolbox(self):
122123
if self.toolbox.isVisible():

‎python/plugins/sextante/core/SextanteUtils.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def userFolder():
4040
if not QDir(userDir).exists():
4141
QDir().mkpath(userDir)
4242

43-
return unicode(userDir)
43+
return unicode(QDir.toNativeSeparators(userDir))
4444

4545
@staticmethod
4646
def isWindows():
@@ -52,11 +52,11 @@ def isMac():
5252

5353
@staticmethod
5454
def tempFolder():
55-
tempDir = QFileInfo(QgsApplication.qgisUserDbFilePath()).path() + "/sextante/tempdata"
55+
tempDir = os.path.join(unicode(QDir.tempPath()), "sextante")
5656
if not QDir(tempDir).exists():
5757
QDir().mkpath(tempDir)
5858

59-
return unicode(tempDir)
59+
return unicode(os.path.abspath(tempDir))
6060

6161
@staticmethod
6262
def setTempOutput(out, alg):

0 commit comments

Comments
 (0)
Please sign in to comment.