[chronojump] Fixed graph.R call



commit f0912bdd7d8e6005b0d59d935f53a65379ee6a48
Author: Xavier de Blas <xaviblas gmail com>
Date:   Thu Jan 31 20:23:47 2013 +0100

    Fixed graph.R call

 encoder/graph.R |   23 ++++++++++++-----------
 src/util.cs     |    6 +++---
 2 files changed, 15 insertions(+), 14 deletions(-)
---
diff --git a/encoder/graph.R b/encoder/graph.R
index 1286016..83b879f 100644
--- a/encoder/graph.R
+++ b/encoder/graph.R
@@ -34,27 +34,28 @@ cols=c(colSpeed,colForce,colPower); lty=rep(1,3)
 
 #--- user commands ---
 #way A. passing options to a file
-getOptionsFromFile <- function() {
-	args <- commandArgs(TRUE)
-	optionsCon <- file(args[1], 'r')
+getOptionsFromFile <- function(optionsFile) {
+	optionsCon <- file(optionsFile, 'r')
 	options=readLines(optionsCon,n=15)
+	close(optionsCon)
 	return (options)
 }
 
 #way B. put options as arguments
-options <- commandArgs(TRUE)
+#unused because maybe command line gets too long
+#options <- commandArgs(TRUE)
 
-OutputData2=options[4] #currently used to display status
 
-#options=getOtionsFromFile();
+args <- commandArgs(TRUE)
+eval(parse(text=args[[1]])) #optionsFile is assigned in R CMD BATCH:  '--args optionsFile="/tmp/Roptions.txt"' 
 
-print(options)
+print(optionsFile)
 
-if(length(options) < 3) {
-#	print("USAGE:\nRscript graph.R c superpose graph.png\neccons:curves, single, side, superpose, powerBars \nsingle and superpose needs a param at end (the jump):\nRscript graph.R c single graph.png 2\n")
-	quit()
-}
+options=getOptionsFromFile(optionsFile);
 
+print(options)
+
+OutputData2=options[4] #currently used to display status
 
 write("(1/5) Starting R", OutputData2)
 
diff --git a/src/util.cs b/src/util.cs
index 029fbe3..8a4a4df 100644
--- a/src/util.cs
+++ b/src/util.cs
@@ -1139,9 +1139,9 @@ public class Util
 		((IDisposable)writer).Dispose();
 
 		//pinfo.Arguments = script + " " + optionsFile;
-		pinfo.Arguments = "CMD BATCH --no-save '--args=" + optionsFile + "' " + 
-			getEncoderScriptGraph() + " " + 
-			Path.GetTempPath() + "error.txt";
+		pinfo.Arguments = "CMD BATCH --no-save '--args optionsFile=\"" + optionsFile + "\"' \"" + 
+			getEncoderScriptGraph() + "\" \"" + 
+			Path.GetTempPath() + "error.txt\"";
 		
 		//--- way B. put options as arguments
 		/*



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]