Skip to content

Commit

Permalink
use system-wide temp directory for temporary files instead of own dir in
Browse files Browse the repository at this point in the history
user profile
  • Loading branch information
alexbruy committed Dec 20, 2012
1 parent 97812b4 commit 8cb888c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
15 changes: 8 additions & 7 deletions python/plugins/sextante/SextantePlugin.py
Expand Up @@ -110,13 +110,14 @@ def unload(self):
self.menu.deleteLater()
#delete temporary output files
folder = SextanteUtils.tempFolder()
for f in os.listdir(folder):
path = os.path.join(folder,f)
try:
os.unlink(path)
except:
#leave files that could not be deleted
pass
if QDir(folder).exists():
for f in os.listdir(folder):
path = os.path.join(folder, f)
try:
os.unlink(path)
except:
#leave files that could not be deleted
pass

def openToolbox(self):
if self.toolbox.isVisible():
Expand Down
6 changes: 3 additions & 3 deletions python/plugins/sextante/core/SextanteUtils.py
Expand Up @@ -40,7 +40,7 @@ def userFolder():
if not QDir(userDir).exists():
QDir().mkpath(userDir)

return unicode(userDir)
return unicode(QDir.toNativeSeparators(userDir))

@staticmethod
def isWindows():
Expand All @@ -52,11 +52,11 @@ def isMac():

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

return unicode(tempDir)
return unicode(os.path.abspath(tempDir))

@staticmethod
def setTempOutput(out, alg):
Expand Down

0 comments on commit 8cb888c

Please sign in to comment.