[chronojump] Win32 fixes for R command execution
- From: Andoni Morales Alastruey <amorales src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [chronojump] Win32 fixes for R command execution
- Date: Thu, 3 Sep 2009 13:06:29 +0000 (UTC)
commit 3aa8a7d57703e34497716b4efdc30fc16387642a
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date: Thu Sep 3 14:58:46 2009 +0200
Win32 fixes for R command execution
chronojump_server/bin/chronojumpServer.dll | Bin 272896 -> 272896 bytes
src/stats/main.cs | 9 ++++-----
src/util.cs | 22 ++++++++++++++++++++++
3 files changed, 26 insertions(+), 5 deletions(-)
---
diff --git a/chronojump_server/bin/chronojumpServer.dll b/chronojump_server/bin/chronojumpServer.dll
index ef87c6d..bcd24b1 100755
Binary files a/chronojump_server/bin/chronojumpServer.dll and b/chronojump_server/bin/chronojumpServer.dll differ
diff --git a/src/stats/main.cs b/src/stats/main.cs
index 69c30ba..4ad48bc 100644
--- a/src/stats/main.cs
+++ b/src/stats/main.cs
@@ -1198,10 +1198,10 @@ public class Stat
//if found 3 images, sure will be 1.png, 2.png and 3.png, next will be 4.png
//there will be always a png with chronojump_logo
- fileName = System.IO.Path.Combine(directoryName, pngs.Length.ToString() + ".png");
+ fileName = directoryName+"/"+pngs.Length.ToString() + ".png";
} else
- fileName = System.IO.Path.Combine(Path.GetTempPath(), fileName);
-
+ fileName = Path.GetTempPath()+"/"+fileName;
+
string rString = "png(filename = '" + fileName + "'\n" +
" , width = " + gRO.Width + ", height = " + gRO.Height + ", units = 'px'\n" +
" , pointsize = 12, bg = 'white', res = NA)\n";
@@ -1269,8 +1269,7 @@ public class Stat
writer.Flush();
((IDisposable)writer).Dispose();
- Process r = Process.Start("R CMD BATCH " + rScript);
- r.WaitForExit();
+ Util.RunRScript(rScript);
if(show) {
if(! File.Exists(fileName) || File.GetLastWriteTime(fileName) < File.GetLastWriteTime(rScript))
diff --git a/src/util.cs b/src/util.cs
index 290feba..9c0ff06 100644
--- a/src/util.cs
+++ b/src/util.cs
@@ -711,6 +711,28 @@ public class Util
}
}
+ public static void RunRScript(string rScript){
+ ProcessStartInfo pinfo;
+ Process r;
+ string rBin="R";
+ //If output file is not given, R will try to write in the running folder
+ //in which we may haven't got permissions
+ string outputFile = System.IO.Path.Combine(Path.GetTempPath(), Constants.FileNameRScript+".Rout");
+
+ if (IsWindows())
+ rBin=System.IO.Path.Combine(GetPrefixDir(), "bin/R.exe");
+
+ pinfo = new ProcessStartInfo();
+ pinfo.FileName=rBin;
+ pinfo.Arguments ="CMD BATCH " + rScript +" " + outputFile;
+ pinfo.CreateNoWindow = true;
+ pinfo.UseShellExecute = false;
+
+ r = new Process();
+ r.StartInfo = pinfo;
+ r.Start();
+ r.WaitForExit();
+ }
/*
* currently not used, we copy the assemblies now
*
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]