Skip to content

Commit

Permalink
Add R_LIBS_USER option for windows
Browse files Browse the repository at this point in the history
Hopefully a more proper attempt to fix http://hub.qgis.org/issues/11603 directly in processing by means of providing an option to define a path for user libraries on MS Windows. Not sure if this could be useful for other OSes too?
  • Loading branch information
ninsbl committed May 5, 2015
1 parent f8ff073 commit 3fcc101
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion python/plugins/processing/algs/r/RUtils.py
Expand Up @@ -41,6 +41,7 @@ class RUtils:
RSCRIPTS_FOLDER = 'R_SCRIPTS_FOLDER'
R_FOLDER = 'R_FOLDER'
R_USE64 = 'R_USE64'
R_LIBS_USER = 'R_LIBS_USER'

@staticmethod
def RFolder():
Expand All @@ -50,6 +51,15 @@ def RFolder():

return os.path.abspath(unicode(folder))

@staticmethod
def RLibs():
folder = ProcessingConfig.getSetting(RUtils.R_LIBS_USER)
if folder is None:
folder = unicode(os.path.join(userFolder(), 'rlibs'))
mkdir(folder)

return os.path.abspath(unicode(folder))

@staticmethod
def RScriptsFolder():
folder = ProcessingConfig.getSetting(RUtils.RSCRIPTS_FOLDER)
Expand Down Expand Up @@ -90,8 +100,9 @@ def executeRAlgorithm(alg, progress):
'BATCH',
'--vanilla',
RUtils.getRScriptFilename(),
RUtils.getConsoleOutputFilename(),
RUtils.getConsoleOutputFilename()
]

else:
os.chmod(RUtils.getRScriptFilename(), stat.S_IEXEC | stat.S_IREAD
| stat.S_IWRITE)
Expand Down

0 comments on commit 3fcc101

Please sign in to comment.