Skip to content

Commit 93feb8b

Browse files
committedDec 12, 2016
[processing] fixes for SAGA folder configuration
This tries to address some problem with previously set SAGA paths, by always showing the SAGA path config value, and by trying to ruin a built in copy of SAGA if the current SAGA folder is wrong (as it usually happens when updating QGIS)
1 parent c17837c commit 93feb8b

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed
 

‎python/plugins/processing/algs/saga/SagaAlgorithmProvider.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def __init__(self):
5757
self.activate = True
5858

5959
def initializeSettings(self):
60-
if (isWindows() or isMac()) and SagaUtils.findSagaFolder() is None:
60+
if (isWindows() or isMac()):
6161
ProcessingConfig.addSetting(Setting("SAGA",
6262
SagaUtils.SAGA_FOLDER, self.tr('SAGA folder'),
6363
'',
@@ -77,7 +77,7 @@ def initializeSettings(self):
7777

7878
def unload(self):
7979
AlgorithmProvider.unload(self)
80-
if (isWindows() or isMac()) and SagaUtils.findSagaFolder() is None:
80+
if (isWindows() or isMac()):
8181
ProcessingConfig.removeSetting(SagaUtils.SAGA_FOLDER)
8282

8383
ProcessingConfig.removeSetting(SagaUtils.SAGA_LOG_CONSOLE)

‎python/plugins/processing/algs/saga/SagaUtils.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,13 @@ def findSagaFolder():
7272

7373
def sagaPath():
7474
folder = ProcessingConfig.getSetting(SAGA_FOLDER)
75+
if not os.path.isdir(folder):
76+
folder = None
77+
ProcessingLog.addToLog(ProcessingLog.LOG_WARNING,
78+
'Specified SAGA folder does not exist. Will try to find built-in binaries.')
7579
if folder is None or folder == '':
7680
folder = findSagaFolder()
77-
if folder is not None:
78-
ProcessingConfig.setSettingValue(SAGA_FOLDER, folder)
81+
7982
return folder or ''
8083

8184

0 commit comments

Comments
 (0)
Please sign in to comment.