[chronojump/chronojump-importer] Fixes error on OS-X. On OS-X we have to execute Python with the script name.



commit d7e59c87ae917a65a428ea4fcaba127c86bda527
Author: Carles Pina i Estany <carles pina cat>
Date:   Wed Sep 28 13:50:52 2016 +0200

    Fixes error on OS-X. On OS-X we have to execute Python with the script name.
    
    On Linux (previously was tested on Linux and Windows) it's not needed to
    execute python + script name (with the script name is enough). On
    Windows it's a different story with the py2exec.

 src/gui/chronojump.cs |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/src/gui/chronojump.cs b/src/gui/chronojump.cs
index 7586636..5db11f3 100644
--- a/src/gui/chronojump.cs
+++ b/src/gui/chronojump.cs
@@ -2410,10 +2410,13 @@ public partial class ChronoJumpWindow
                string session = Convert.ToString (sessionNumber);
                string importer_executable;
 
+               string importer_script_path = "";
+
                if (UtilAll.IsWindows()) {
                        importer_executable = System.IO.Path.Combine (Util.GetPrefixDir (), 
"bin\\chronojump-importer\\chronojump_importer.exe");
                } else {
-                       importer_executable = System.IO.Path.Combine (Util.GetPrefixDir (), "bin" + 
Path.DirectorySeparatorChar + "chronojump_importer.py");
+                       importer_executable = "python";         // chronojump_importer works on Python 2 and 
Python 3
+                       importer_script_path = "\"" + CommandLineEncoder.EncodeArgText(System.IO.Path.Combine 
(Util.GetPrefixDir (), "bin" + Path.DirectorySeparatorChar + "chronojump_importer.py")) + "\"";
                }
 
                Process process = new Process();
@@ -2421,7 +2424,7 @@ public partial class ChronoJumpWindow
 
                processStartInfo = new ProcessStartInfo();
 
-               processStartInfo.Arguments = " --source \"" + CommandLineEncoder.EncodeArgText 
(source_filename) + "\" --destination \"" + CommandLineEncoder.EncodeArgText (destination_filename) + "\" 
--source_session \"" + CommandLineEncoder.EncodeArgText (session) + "\"";
+               processStartInfo.Arguments = importer_script_path + " --source \"" + 
CommandLineEncoder.EncodeArgText (source_filename) + "\" --destination \"" + CommandLineEncoder.EncodeArgText 
(destination_filename) + "\" --source_session \"" + CommandLineEncoder.EncodeArgText (session) + "\"";
                processStartInfo.FileName = importer_executable;
 
                LogB.Debug ("chronojump-importer fileName:" + processStartInfo.FileName);


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