[chronojump] Fixed path to windows spaced dirs
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] Fixed path to windows spaced dirs
- Date: Fri, 1 Feb 2013 17:54:34 +0000 (UTC)
commit 2c334f6e2bcc9d9fe50dfe8d73029cf4115cd22d
Author: Xavier de Blas <xaviblas gmail com>
Date: Fri Feb 1 18:53:28 2013 +0100
Fixed path to windows spaced dirs
encoder/pyserial_pyper_windows.py | 5 ++++-
src/util.cs | 22 ++++++++++++++++++----
2 files changed, 22 insertions(+), 5 deletions(-)
---
diff --git a/encoder/pyserial_pyper_windows.py b/encoder/pyserial_pyper_windows.py
index 431e47c..c907d5f 100644
--- a/encoder/pyserial_pyper_windows.py
+++ b/encoder/pyserial_pyper_windows.py
@@ -429,8 +429,11 @@ if __name__ == '__main__':
- #print "connecting with R"
+ print "connecting with R"
#myR = R()
+ print r_path
+ r_path = r_path.replace("WINDOWSSPACEMARK"," ")
+ print r_path
myR = R(RCMD=r_path)
myR.run('library("EMD")') #needed on reducing curve by speed (extrema)
diff --git a/src/util.cs b/src/util.cs
index b9d334e..4ca5ac1 100644
--- a/src/util.cs
+++ b/src/util.cs
@@ -333,6 +333,13 @@ public class Util
myStringBuilder.Replace(" ", "_");
return myStringBuilder.ToString();
}
+
+ private static string changeSpaceToSpaceMark(string myString)
+ {
+ StringBuilder myStringBuilder = new StringBuilder(myString);
+ myStringBuilder.Replace(" ", "WINDOWSSPACEMARK");
+ return myStringBuilder.ToString();
+ }
public static string GetHeightInCentimeters (string time) {
// s = 4.9 * (tv/2)^2
@@ -1086,7 +1093,8 @@ public class Util
if (IsWindows()) {
pBin=getEncoderScriptCapture();
pinfo.Arguments = title + " " + es.OutputData1 + " " + es.Ep.ToString1() + " " + port
- + " " + System.IO.Path.Combine(GetPrefixDir(), "bin" + Path.DirectorySeparatorChar + "R");
+ + " " + changeSpaceToSpaceMark(
+ System.IO.Path.Combine(GetPrefixDir(), "bin" + Path.DirectorySeparatorChar + "R.exe"));
}
else {
pBin="python";
@@ -1130,7 +1138,9 @@ public class Util
pBin="Rscript";
//pBin="R";
if (IsWindows()) {
- pBin=System.IO.Path.Combine(GetPrefixDir(), "bin" + Path.DirectorySeparatorChar + "Rscript.exe");
+ //on Windows we need the \"str\" to call without problems in path with spaces
+ pBin = "\"" + System.IO.Path.Combine(GetPrefixDir(), "bin" + Path.DirectorySeparatorChar + "Rscript.exe") + "\"";
+ Log.WriteLine("pBin:" + pBin);
//On win32 R understands backlash as an escape character and
//a file path uses Unix-like path separator '/'
@@ -1156,8 +1166,12 @@ public class Util
//a file path uses Unix-like path separator '/'
optionsFile = optionsFile.Replace("\\","/");
}
-
- pinfo.Arguments = getEncoderScriptGraph() + " " + optionsFile;
+
+ //on Windows we need the \"str\" to call without problems in path with spaces
+ pinfo.Arguments = "\"" + getEncoderScriptGraph() + "\" " + optionsFile;
+
+ Log.WriteLine("Arguments:" + pinfo.Arguments);
+
/*
pinfo.Arguments = "CMD BATCH --no-save '--args optionsFile=\"" + optionsFile + "\"' \"" +
getEncoderScriptGraph() + "\" \"" +
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]