@@ -64,9 +64,17 @@ def findSagaFolder():
64
64
if os .path .exists (os .path .join (testfolder , 'saga_cmd' )):
65
65
folder = testfolder
66
66
elif isWindows ():
67
- testfolder = os .path .join (os .path .dirname (QgsApplication .prefixPath ()), 'saga' )
68
- if os .path .exists (os .path .join (testfolder , 'saga_cmd.exe' )):
69
- folder = testfolder
67
+ folders = []
68
+ folders .append (os .path .join (os .path .dirname (QgsApplication .prefixPath ()), 'saga' ))
69
+ if "OSGEO4W_ROOT" in os .environ :
70
+ folders .append (os .path .join (str (os .environ ['OSGEO4W_ROOT' ]), "apps" , "saga-ltr" ))
71
+ folders .append (os .path .join (str (os .environ ['OSGEO4W_ROOT' ]), "apps" , "saga" ))
72
+
73
+ for testfolder in folders :
74
+ if os .path .exists (os .path .join (testfolder , 'saga_cmd.exe' )):
75
+ folder = testfolder
76
+ break
77
+
70
78
return folder
71
79
72
80
@@ -164,8 +172,8 @@ def executeSaga(progress):
164
172
if isWindows ():
165
173
command = ['cmd.exe' , '/C ' , sagaBatchJobFilename ()]
166
174
else :
167
- os .chmod (sagaBatchJobFilename (), stat .S_IEXEC
168
- | stat .S_IREAD | stat .S_IWRITE )
175
+ os .chmod (sagaBatchJobFilename (), stat .S_IEXEC |
176
+ stat .S_IREAD | stat .S_IWRITE )
169
177
command = [sagaBatchJobFilename ()]
170
178
loglines = []
171
179
loglines .append (QCoreApplication .translate ('SagaUtils' , 'SAGA execution console output' ))
0 commit comments