File tree Expand file tree Collapse file tree 1 file changed +20
-1
lines changed
python/plugins/processing/algs/r Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -47,7 +47,26 @@ class RUtils:
47
47
def RFolder ():
48
48
folder = ProcessingConfig .getSetting (RUtils .R_FOLDER )
49
49
if folder is None :
50
- folder = ''
50
+ if isWindows ():
51
+ if "ProgramW6432" in os .environ .keys () and os .path .isdir (os .path .join (os .environ ["ProgramW6432" ],'R' )):
52
+ testfolder = os .path .join (os .environ ["ProgramW6432" ],'R' )
53
+ elif "PROGRAMFILES(x86)" in os .environ .keys () and os .path .isdir (os .path .join (os .environ ["PROGRAMFILES(x86)" ],'R' )):
54
+ testfolder = os .path .join (os .environ ["PROGRAMFILES(x86)" ],'R' )
55
+ elif "PROGRAMFILES" in os .environ .keys () and os .path .isdir (os .path .join (os .environ ["PROGRAMFILES" ],'R' )):
56
+ testfolder = os .path .join (os .environ ["PROGRAMFILES" ],'R' )
57
+ else :
58
+ testfolder = 'C:\\ R'
59
+ if os .path .isdir (testfolder ):
60
+ subfolders = os .listdir (testfolder )
61
+ subfolders .sort (reverse = True )
62
+ for subfolder in subfolders :
63
+ if subfolder .startswith ('R-' ):
64
+ folder = os .path .join (testfolder , subfolder )
65
+ break
66
+ else :
67
+ folder = ''
68
+ else :
69
+ folder = ''
51
70
52
71
return os .path .abspath (unicode (folder ))
53
72
You can’t perform that action at this time.
0 commit comments