@@ -63,9 +63,17 @@ def findSagaFolder():
63
63
if os .path .exists (os .path .join (testfolder , 'saga_cmd' )):
64
64
folder = testfolder
65
65
elif isWindows ():
66
- testfolder = os .path .join (os .path .dirname (QgsApplication .prefixPath ()), 'saga' )
67
- if os .path .exists (os .path .join (testfolder , 'saga_cmd.exe' )):
68
- folder = testfolder
66
+ folders = []
67
+ folders .append (os .path .join (os .path .dirname (QgsApplication .prefixPath ()), 'saga' ))
68
+ if "OSGEO4W_ROOT" in os .environ :
69
+ folders .append (os .path .join (str (os .environ ['OSGEO4W_ROOT' ]), "apps" , "saga-ltr" ))
70
+ folders .append (os .path .join (str (os .environ ['OSGEO4W_ROOT' ]), "apps" , "saga" ))
71
+
72
+ for testfolder in folders :
73
+ if os .path .exists (os .path .join (testfolder , 'saga_cmd.exe' )):
74
+ folder = testfolder
75
+ break
76
+
69
77
return folder
70
78
71
79
@@ -153,8 +161,8 @@ def executeSaga(progress):
153
161
if isWindows ():
154
162
command = ['cmd.exe' , '/C ' , sagaBatchJobFilename ()]
155
163
else :
156
- os .chmod (sagaBatchJobFilename (), stat .S_IEXEC
157
- | stat .S_IREAD | stat .S_IWRITE )
164
+ os .chmod (sagaBatchJobFilename (), stat .S_IEXEC |
165
+ stat .S_IREAD | stat .S_IWRITE )
158
166
command = [sagaBatchJobFilename ()]
159
167
loglines = []
160
168
loglines .append (QCoreApplication .translate ('SagaUtils' , 'SAGA execution console output' ))
0 commit comments