Skip to content

Commit dceb142

Browse files
volayaalexbruy
authored andcommitted
[processing] extra checks to avoid issues with previous versions values
1 parent 505c5ee commit dceb142

File tree

3 files changed

+18
-3
lines changed

3 files changed

+18
-3
lines changed

python/plugins/processing/algs/grass/GrassUtils.py

+4
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ def grassPath():
8787
return ''
8888

8989
folder = ProcessingConfig.getSetting(GrassUtils.GRASS_FOLDER)
90+
if not os.path.exists(folder):
91+
folder = None
9092
if folder is None:
9193
if isWindows():
9294
testfolder = os.path.dirname(QgsApplication.prefixPath())
@@ -106,6 +108,8 @@ def grassPath():
106108
@staticmethod
107109
def grassWinShell():
108110
folder = ProcessingConfig.getSetting(GrassUtils.GRASS_WIN_SHELL)
111+
if not os.path.exists(folder):
112+
folder = None
109113
if folder is None:
110114
folder = os.path.dirname(unicode(QgsApplication.prefixPath()))
111115
folder = os.path.join(folder, 'msys')

python/plugins/processing/algs/grass7/Grass7Utils.py

+4
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ def grassPath():
8585
return ''
8686

8787
folder = ProcessingConfig.getSetting(Grass7Utils.GRASS_FOLDER)
88+
if not os.path.exists(folder):
89+
folder = None
8890
if folder is None:
8991
if isWindows():
9092
testfolder = os.path.dirname(unicode(QgsApplication.prefixPath()))
@@ -104,6 +106,8 @@ def grassPath():
104106
@staticmethod
105107
def grassWinShell():
106108
folder = ProcessingConfig.getSetting(Grass7Utils.GRASS_WIN_SHELL)
109+
if not os.path.exists(folder):
110+
folder = None
107111
if folder is None:
108112
folder = os.path.dirname(unicode(QgsApplication.prefixPath()))
109113
folder = os.path.join(folder, 'msys')

python/plugins/processing/algs/r/RUtils.py

+10-3
Original file line numberDiff line numberDiff line change
@@ -56,16 +56,23 @@ def RLibs():
5656
folder = ProcessingConfig.getSetting(RUtils.R_LIBS_USER)
5757
if folder is None:
5858
folder = unicode(os.path.join(userFolder(), 'rlibs'))
59-
mkdir(folder)
60-
59+
try:
60+
mkdir(folder)
61+
except:
62+
folder = unicode(os.path.join(userFolder(), 'rlibs'))
63+
mkdir(folder)
6164
return os.path.abspath(unicode(folder))
6265

6366
@staticmethod
6467
def RScriptsFolder():
6568
folder = ProcessingConfig.getSetting(RUtils.RSCRIPTS_FOLDER)
6669
if folder is None:
6770
folder = unicode(os.path.join(userFolder(), 'rscripts'))
68-
mkdir(folder)
71+
try:
72+
mkdir(folder)
73+
except:
74+
folder = unicode(os.path.join(userFolder(), 'rscripts'))
75+
mkdir(folder)
6976

7077
return os.path.abspath(folder)
7178

0 commit comments

Comments
 (0)