[chronojump] Fixes problem on Windows when executing chronojump_importer.



commit e18997afa243e4b16e75bebcdd7782c810ab735b
Author: Carles Pina i Estany <carles pina cat>
Date:   Thu Oct 20 22:54:05 2016 +0200

    Fixes problem on Windows when executing chronojump_importer.
    
    The problem is that an empty string was passed to the Python as an
    argument on Windows (see the line parameters.Insret (0,
    importer_script_path) and the chronojump_importer.py returned an error:
    an empt parameter is not a recognized option.

 src/chronojumpImporter.cs |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)
---
diff --git a/src/chronojumpImporter.cs b/src/chronojumpImporter.cs
index 2e318f9..14e1de3 100644
--- a/src/chronojumpImporter.cs
+++ b/src/chronojumpImporter.cs
@@ -164,16 +164,21 @@ class ChronojumpImporter
        private Result executeChronojumpImporter(List<string> parameters)
        {
                string importer_executable;
-               string importer_script_path = "";
 
                if (UtilAll.IsWindows()) {
+                       // On Windows we execute the .exe file (it's the Python with py2exe)
                        importer_executable = System.IO.Path.Combine (Util.GetPrefixDir (), 
"bin\\chronojump-importer\\chronojump_importer.exe");
                } else {
-                       importer_executable = "python";         // chronojump_importer works on Python 2 and 
Python 3
-                       importer_script_path = System.IO.Path.Combine (Util.GetPrefixDir (), 
"bin/chronojump_importer.py");
+                       // On Linux and OSX we execute Python and we pass the path to the script as a first 
argument
+
+                       importer_executable = "python";         // chronojump_importer.py works on Python 2 
and Python 3
+
+                       string importer_script_path = System.IO.Path.Combine (Util.GetPrefixDir (), 
"bin/chronojump_importer.py");
+
+                       // first argument of the Python: the path to the script
+                       parameters.Insert (0, importer_script_path);
                }
 
-               parameters.Insert (0, importer_script_path);
                ExecuteProcess.Result execute_result = ExecuteProcess.run (importer_executable, parameters);
 
                if (execute_result.exitCode != 0) {


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