Add R_LIBS_USER option for windows

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?
This commit is contained in:
Stefan Blumentrath 2015-05-05 19:08:27 +02:00
parent f8ff073dd9
commit 3fcc101446

View File

@ -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():
@ -50,6 +51,15 @@ class RUtils:
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)
@ -90,8 +100,9 @@ class RUtils:
'BATCH',
'--vanilla',
RUtils.getRScriptFilename(),
RUtils.getConsoleOutputFilename(),
RUtils.getConsoleOutputFilename()
]
else:
os.chmod(RUtils.getRScriptFilename(), stat.S_IEXEC | stat.S_IREAD
| stat.S_IWRITE)