[chronojump] Encoder Importer: Fixed no "curve" folder created if there are no curves



commit 5d7f8980e4cc7f14b9acc3a44627c1fba65e3e3c
Author: Xavier de Blas <xaviblas gmail com>
Date:   Wed Jun 5 18:22:15 2019 +0200

    Encoder Importer: Fixed no "curve" folder created if there are no curves

 src/chronojump-importer/chronojump_importer.py | 11 +++++++++++
 1 file changed, 11 insertions(+)
---
diff --git a/src/chronojump-importer/chronojump_importer.py b/src/chronojump-importer/chronojump_importer.py
index fda4b0ea..4d40f64e 100755
--- a/src/chronojump-importer/chronojump_importer.py
+++ b/src/chronojump-importer/chronojump_importer.py
@@ -30,6 +30,7 @@ logging.basicConfig(level=logging.INFO)
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
  * Copyright (C) 2016-2017 Carles Pina i Estany <carles pina cat>
+ * Copyright (C) 2019 Xavier de Blas <xaviblas gmail com>
  */
 """
 
@@ -703,6 +704,16 @@ class ImportSession:
 
             shutil.copy(source_file, destination_filename)
 
+            # If on origin there are no curves, curve folder will not be created
+            # and after import curves will not be saved on clicking at capture treeview
+            # create "curve" folder if not exists
+            destination_url = self._encoder_url(session_id, "curve")
+            destination_directory = os.path.join(destination_dself.destination_path, "..", "..", 
destination_url)
+            destination_directory = os.path.abspath(destination_directory)  # os.makedirs() can't handle 
directories with ".."
+            if not os.path.isdir(destination_directory):
+                os.makedirs(destination_directory)
+
+
 
 def json_information(database_path):
     information = {}


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