[chronojump] RaceAnalyzer ExportFiles sending URL to R cares for \\ to / on Windows



commit 346b0821a858f8d0f41c961bc38ea9f7e4ba7cfd
Author: Xavier de Blas <xaviblas gmail com>
Date:   Thu Jun 10 10:50:35 2021 +0200

    RaceAnalyzer ExportFiles sending URL to R cares for \\ to / on Windows

 src/exportFiles/re.cs | 1 +
 src/runEncoder.cs     | 9 ++++++++-
 2 files changed, 9 insertions(+), 1 deletion(-)
---
diff --git a/src/exportFiles/re.cs b/src/exportFiles/re.cs
index e4640cb21..4680bd21f 100644
--- a/src/exportFiles/re.cs
+++ b/src/exportFiles/re.cs
@@ -163,6 +163,7 @@ public class RunEncoderExport : ExportFiles
                                Util.ChangeSpaceAndMinusForUnderscore(reEx.Name);
 
                        RunEncoderGraphExport rege = new RunEncoderGraphExport (
+                                       isWindows,
                                        re.FullURL,
                                        ps.Weight, ps.Height,
                                        re.Device,
diff --git a/src/runEncoder.cs b/src/runEncoder.cs
index fda3d7f74..4f5a745f6 100644
--- a/src/runEncoder.cs
+++ b/src/runEncoder.cs
@@ -504,6 +504,7 @@ public class RunEncoderCSV
 //this class creates the rows of each set for the csv input multi that is read by R
 public class RunEncoderGraphExport
 {
+       private bool isWindows;
        private string fullURL;
        private double mass;
        private double personHeight;
@@ -517,6 +518,7 @@ public class RunEncoderGraphExport
        private string comments;
 
        public RunEncoderGraphExport(
+                       bool isWindows,
                        string fullURL,
                        double mass, double personHeight,
                        RunEncoder.Devices device,
@@ -525,6 +527,7 @@ public class RunEncoderGraphExport
                        TriggerList triggerList,
                        string comments)
        {
+               this.isWindows = isWindows;
                this.fullURL = fullURL; //filename
                this.mass = mass;
                this.personHeight = personHeight;
@@ -540,7 +543,11 @@ public class RunEncoderGraphExport
 
        public string ToCSVRowOnExport()
        {
-               return fullURL + ";" +
+               string url = fullURL;
+               if(isWindows)
+                       url = url.Replace("\\","/");
+
+               return url + ";" +
                        Util.ConvertToPoint(mass) + ";" +
                        Util.ConvertToPoint(personHeight / 100.0) + ";" + //in meters
                        device.ToString() + ";" +


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