Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
processing: improve saga detection on windows
(cherry picked from commit 0d1ab70)
  • Loading branch information
jef-n committed Mar 24, 2017
1 parent 25d9df3 commit 0378214
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions python/plugins/processing/algs/saga/SagaUtils.py
Expand Up @@ -64,9 +64,17 @@ def findSagaFolder():
if os.path.exists(os.path.join(testfolder, 'saga_cmd')):
folder = testfolder
elif isWindows():
testfolder = os.path.join(os.path.dirname(QgsApplication.prefixPath()), 'saga')
if os.path.exists(os.path.join(testfolder, 'saga_cmd.exe')):
folder = testfolder
folders = []
folders.append(os.path.join(os.path.dirname(QgsApplication.prefixPath()), 'saga'))
if "OSGEO4W_ROOT" in os.environ:
folders.append(os.path.join(str(os.environ['OSGEO4W_ROOT']), "apps", "saga-ltr"))
folders.append(os.path.join(str(os.environ['OSGEO4W_ROOT']), "apps", "saga"))

for testfolder in folders:
if os.path.exists(os.path.join(testfolder, 'saga_cmd.exe')):
folder = testfolder
break

return folder


Expand Down Expand Up @@ -164,8 +172,8 @@ def executeSaga(progress):
if isWindows():
command = ['cmd.exe', '/C ', sagaBatchJobFilename()]
else:
os.chmod(sagaBatchJobFilename(), stat.S_IEXEC
| stat.S_IREAD | stat.S_IWRITE)
os.chmod(sagaBatchJobFilename(), stat.S_IEXEC |
stat.S_IREAD | stat.S_IWRITE)
command = [sagaBatchJobFilename()]
loglines = []
loglines.append(QCoreApplication.translate('SagaUtils', 'SAGA execution console output'))
Expand Down

0 comments on commit 0378214

Please sign in to comment.