From 44d69d653c9e717b70fc4ca3062a9af1c9a6184e Mon Sep 17 00:00:00 2001 From: Dave Goodwin Date: Sun, 11 Feb 2007 17:09:44 +0000 Subject: [PATCH] added support for Python and temp directory paths that contain spaces --- Cantera/src/ct2ctml.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Cantera/src/ct2ctml.cpp b/Cantera/src/ct2ctml.cpp index 443d500ea..ee41bd163 100644 --- a/Cantera/src/ct2ctml.cpp +++ b/Cantera/src/ct2ctml.cpp @@ -38,7 +38,12 @@ namespace ctml { const char* py = getenv("PYTHON_CMD"); if (py) { string sp = stripws(string(py)); - if (sp.size() > 0) s = sp; + if (sp.size() > 0) { + if (s.find(' ') != std::string::npos) + s = "\"" + sp + "\""; + else + s = sp; + } } return s; } @@ -59,11 +64,12 @@ namespace ctml { time_t aclock; time( &aclock ); int ia = static_cast(aclock); - string path = tmpDir()+"/.cttmp"+int2str(ia)+".pyw"; + string path = "\"" + tmpDir()+"/.cttmp"+int2str(ia)+".pyw"+"\""; ofstream f(path.c_str()); if (!f) { throw CanteraError("ct2ctml","cannot open "+path+" for writing."); } + f << "from ctml_writer import *\n" << "import sys, os, os.path\n" << "file = \"" << file << "\"\n"