Skip to content

Commit 3f20e3c

Browse files
committed
R support for unix
1 parent 10bace2 commit 3f20e3c

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

processRequest.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ processFunction <- function(indexIn, argument = ""){
3636
# If not run the file generation process
3737
# If it exsists simplily run the script with the argument
3838
if(file.exists(fileName)){
39-
result <- system(paste(paste0(Sys.getenv("R_HOME"), "/bin/Rscript.exe", collapse =""), fileName, argument), intern = T)
39+
result <- system(paste(r_path, fileName, argument), intern = T)
4040
return(result)
4141
# The program should'nt get past this point if the file does exsist so we don't need an else{} statement
4242
}
@@ -51,7 +51,7 @@ processFunction <- function(indexIn, argument = ""){
5151
}
5252

5353
writeLines(as.character(wFinal), con = fileName, sep = "\n", useBytes = FALSE) # auto indents lines
54-
result <- system(paste(paste0(Sys.getenv("R_HOME"), "/bin/Rscript.exe", collapse =""), fileName, argument), intern = T)
54+
result <- system(paste(r_path, fileName, argument), intern = T)
5555
# Call dataType Processorn to test data types
5656

5757
#file.remove(fileName)

setPaths.R

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,15 @@
1616
# Then get them into system vars that can be accessed later.
1717
path_list <- read.csv("dataTypes/paths.csv")
1818

19-
# r_path <- path_list$path[] # Doesnt need this path
19+
# The R path has to be different given the os_version (system var)
20+
if(os_version == 0){
21+
# Windows
22+
# This looks for your R version are runs
23+
r_path <- paste0(Sys.getenv("R_HOME"), "/bin/Rscript.exe", collapse ="")
24+
} else {
25+
# Unix
26+
r_path <- "Rscript"
27+
}
2028
python_path <- path_list$path[2]
2129
js_path <- path_list$path[3]
2230
lua_path <- path_list$path[4]

0 commit comments

Comments
 (0)