[chronojump] ForceSensor export copies 1st to tmp/*.png to avoid windows accents problems



commit 26d2ee5a08d5bd99817f46fd7ec982beeea4c858
Author: Xavier de Blas <xaviblas gmail com>
Date:   Wed Jun 30 12:09:55 2021 +0200

    ForceSensor export copies 1st to tmp/*.png to avoid windows accents problems

 src/exportFiles/exportFiles.cs |  3 +++
 src/exportFiles/fs.cs          | 15 +++++++--------
 2 files changed, 10 insertions(+), 8 deletions(-)
---
diff --git a/src/exportFiles/exportFiles.cs b/src/exportFiles/exportFiles.cs
index 7ba7f48c5..63807c274 100644
--- a/src/exportFiles/exportFiles.cs
+++ b/src/exportFiles/exportFiles.cs
@@ -128,6 +128,9 @@ public abstract class ExportFiles
 
        protected abstract bool getData ();
 
+       protected string getTempSourceFilesDir() {
+               return Path.Combine(Path.GetTempPath(), "chronojump_export_source_files");
+       }
        protected string getTempProgressDir() {
                return Path.Combine(Path.GetTempPath(), "chronojump_export_progress");
        }
diff --git a/src/exportFiles/fs.cs b/src/exportFiles/fs.cs
index d052a5292..20ee5aec0 100644
--- a/src/exportFiles/fs.cs
+++ b/src/exportFiles/fs.cs
@@ -93,6 +93,7 @@ public class ForceSensorExport : ExportFiles
        protected override void createOrEmptyDirs()
        {
                //create progressbar and graph files dirs or delete their contents
+               createOrEmptyDir(getTempSourceFilesDir());
                createOrEmptyDir(getTempProgressDir());
                createOrEmptyDir(getTempGraphsDir());
                createOrEmptyDir(getTempGraphsABDir());
@@ -208,11 +209,9 @@ public class ForceSensorExport : ExportFiles
                        string destination = UtilEncoder.GetmifCSVInputMulti();
                        Util.FileDelete(destination);
 
-
-                       /*
                        //copy file to tmp to be written readed by R
-                       File.Copy(fs.FullURL, UtilEncoder.GetmifCSVFileName(), true); //can be overwritten
-                       */
+                       string fsFullURLMoved = Path.Combine(getTempSourceFilesDir(), count.ToString() + 
".csv");
+                       File.Copy(fs.FullURL, fsFullURLMoved, true); //can be overwritten
 
                        //delete result file
                        Util.FileDelete(getTempCSVFileName());
@@ -249,8 +248,8 @@ public class ForceSensorExport : ExportFiles
                                        }
                                        fsgABe_l.Add(new ForceSensorGraphABExport (
                                                                isWindows,
-                                                               fs.FullURL,
-                                                               Util.CSVDecimalColumnIsPoint(fs.FullURL, 1),
+                                                               fsFullURLMoved,
+                                                               Util.CSVDecimalColumnIsPoint(fsFullURLMoved, 
1),
                                                                fsAI.ForceMAX,                  //raw
                                                                maxAvgForceInWindow,            //raw
                                                                forceSensorAnalyzeMaxAVGInWindowSeconds, //raw
@@ -308,8 +307,8 @@ public class ForceSensorExport : ExportFiles
                                }
                                fsgABe_l.Add(new ForceSensorGraphABExport (
                                                        isWindows,
-                                                       fs.FullURL,
-                                                       Util.CSVDecimalColumnIsPoint(fs.FullURL, 1),
+                                                       fsFullURLMoved,
+                                                       Util.CSVDecimalColumnIsPoint(fsFullURLMoved, 1),
                                                        fsAI.ForceMAX,                  //raw
                                                        maxAvgForceInWindow,            //raw
                                                        forceSensorAnalyzeMaxAVGInWindowSeconds, //raw


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