Skip to content
This repository has been archived by the owner on Apr 20, 2020. It is now read-only.

Commit

Permalink
set R's temporary folder as working directory in build_cmds
Browse files Browse the repository at this point in the history
otherwise, RQGIS breaks beginning with QGIS 2.18.2
  • Loading branch information
jannes-m committed Jan 7, 2017
1 parent 497cefc commit 659d655
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion R/helper_funs.R
Expand Up @@ -31,6 +31,9 @@ build_cmds <- function(qgis_env = set_env()) {
my_qgis <- gsub(".*\\\\", "", qgis_env$qgis_prefix_path)
cmd <-
c("@echo off",
# remember R temp directory, i.e. use the directory from where cmd was
# initialized
"set wd=%~dp0",
# defining a root variable
paste0("SET OSGEO4W_ROOT=", qgis_env$root),
# calling batch files from within a batchfile -> sets many paths
Expand All @@ -44,7 +47,9 @@ build_cmds <- function(qgis_env = set_env()) {
paste0("set PYTHONPATH=%PYTHONPATH%;%OSGEO4W_ROOT%\\apps\\",
my_qgis, "\\python;"),
# defining QGIS prefix path (i.e. without bin)
paste0("set QGIS_PREFIX_PATH=%OSGEO4W_ROOT%\\apps\\", my_qgis)
paste0("set QGIS_PREFIX_PATH=%OSGEO4W_ROOT%\\apps\\", my_qgis),
# return to R temp directory to call later python py_cmd.py
"pushd %wd%"
)

} else if (Sys.info()["sysname"] == "Darwin") {
Expand Down Expand Up @@ -111,6 +116,7 @@ execute_cmds <- function(processing_name = "processing.alglist",

if (Sys.info()["sysname"] == "Windows") {
# write batch command
# cmd <- c(cmds$cmd, paste("python", file.path(tmp_dir, "py_cmd.py")))
cmd <- c(cmds$cmd, "python py_cmd.py")
cmd <- paste(cmd, collapse = "\n")
cat(cmd, file = "batch_cmd.cmd")
Expand Down

1 comment on commit 659d655

@pat-s
Copy link
Member

@pat-s pat-s commented on 659d655 Jan 7, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixes #26

Please sign in to comment.