[chronojump] RDotNet with extrema fixed on windows



commit 88857eeff7f316fcd19b1d3419ef7659e9dcc204
Author: Windows Build <windows chronojump org>
Date:   Mon Mar 10 19:24:20 2014 +0100

    RDotNet with extrema fixed on windows

 src/gui/encoder.cs |   16 +++++++++++++++-
 1 files changed, 15 insertions(+), 1 deletions(-)
---
diff --git a/src/gui/encoder.cs b/src/gui/encoder.cs
index 1211050..c0b2d8e 100644
--- a/src/gui/encoder.cs
+++ b/src/gui/encoder.cs
@@ -1805,8 +1805,22 @@ public partial class ChronoJumpWindow
                */
 
                //load extrema method copied from EMD package
-               rengine.Evaluate("source('" + UtilEncoder.GetEncoderScriptUtilR() + "')");
+               string utilRPath = UtilEncoder.GetEncoderScriptUtilR();
+               
+               //On win32 R understands backlash as an escape character and 
+               //a file path uses Unix-like path separator '/'
+               if(UtilAll.IsWindows())
+                       utilRPath = utilRPath.Replace("\\","/");
+               Log.WriteLine(utilRPath);
+               
+               try {
+                       rengine.Evaluate("source('" + utilRPath + "')");
+               } catch {
+                       RInitialized = Constants.Status.ERROR;
+                       return;
+               }
 
+               
                try {
                        // .NET Framework array to R vector.
                        NumericVector group1 = rengine.CreateNumericVector(new double[] { 30.02, 29.99, 
30.11, 29.97, 30.01, 29.99 });


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