[chronojump] Encoder graph.R: Fixed R path in CSV file



commit b6aeb97d48da08d4966e44562844176f64f14e6b
Author: Xavier de Blas <xaviblas gmail com>
Date:   Tue Feb 19 11:09:01 2013 +0100

    Encoder graph.R: Fixed R path in CSV file

 src/encoder.cs     |   13 +++++++++++--
 src/gui/encoder.cs |    4 ++--
 2 files changed, 13 insertions(+), 4 deletions(-)
---
diff --git a/src/encoder.cs b/src/encoder.cs
index 96da9d7..c6e9fb2 100644
--- a/src/encoder.cs
+++ b/src/encoder.cs
@@ -256,8 +256,17 @@ public class EncoderSQL
                return date;
        }
 
-       public string GetFullURL() {
-               return url + Path.DirectorySeparatorChar + filename;
+       public string GetFullURL(bool convertPathToR) {
+               string str = url + Path.DirectorySeparatorChar + filename;
+               /*      
+                       in Linux is separated by '/'
+                       in windows is separated by '\'
+                       but R needs always '/', then do the conversion
+                */
+               if(convertPathToR && Util.IsWindows())
+                       str = str.Replace("\\","/");
+
+               return str;
        }
 
        public string [] ToStringArray (int count) {
diff --git a/src/gui/encoder.cs b/src/gui/encoder.cs
index 0da42c6..db3786a 100644
--- a/src/gui/encoder.cs
+++ b/src/gui/encoder.cs
@@ -609,7 +609,7 @@ public partial class ChronoJumpWindow
                EncoderSQL eSQL = (EncoderSQL) SqliteEncoder.Select(
                                false, Convert.ToInt32(encoderSignalUniqueID), 0, 0, "")[0];
                //remove the file
-               bool deletedOk = Util.FileDelete(eSQL.GetFullURL());
+               bool deletedOk = Util.FileDelete(eSQL.GetFullURL(false));       //don't convertPathToR
                if(deletedOk) {
                        Sqlite.Delete(Constants.EncoderTable, Convert.ToInt32(encoderSignalUniqueID));
                        encoderSignalUniqueID = "-1";
@@ -915,7 +915,7 @@ public partial class ChronoJumpWindow
                                writer.WriteLine(eSQL.future1 + "," + ex.name + "," + 
                                                Util.ConvertToPoint(mass).ToString() + "," + 
                                                Util.ConvertToPoint(eSQL.smooth) + "," + eSQL.GetDate(true) + 
"," + 
-                                               eSQL.GetFullURL() + "," +
+                                               eSQL.GetFullURL(true) + "," +   //convertPathToR
                                                eSQL.eccon      //this is the eccon of every curve
                                                );
                        }


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