minor cleanup
This commit is contained in:
parent
e805dc2860
commit
609ff8fa8f
1 changed files with 12 additions and 7 deletions
|
|
@ -22,6 +22,8 @@
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include "ctml.h"
|
#include "ctml.h"
|
||||||
|
|
||||||
|
//#define DEBUG_PATHS
|
||||||
|
|
||||||
using namespace Cantera;
|
using namespace Cantera;
|
||||||
|
|
||||||
namespace ctml {
|
namespace ctml {
|
||||||
|
|
@ -34,11 +36,13 @@ namespace ctml {
|
||||||
string s = "python";
|
string s = "python";
|
||||||
const char* py = getenv("PYTHON_CMD");
|
const char* py = getenv("PYTHON_CMD");
|
||||||
if (py) {
|
if (py) {
|
||||||
s = string(py);
|
string sp = stripws(string(py));
|
||||||
|
if (sp.size() > 0) s = sp;
|
||||||
}
|
}
|
||||||
#ifdef PYTHON_EXE
|
#ifdef PYTHON_EXE
|
||||||
else {
|
else {
|
||||||
s = string(PYTHON_EXE);
|
string se = stripws(string(PYTHON_EXE));
|
||||||
|
if (se.size() > 0) s = se;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return s;
|
return s;
|
||||||
|
|
@ -119,7 +123,7 @@ namespace ctml {
|
||||||
string cmd = pypath() + " " + path + " &> ct2ctml.log";
|
string cmd = pypath() + " " + path + " &> ct2ctml.log";
|
||||||
#endif
|
#endif
|
||||||
#ifdef DEBUG_PATHS
|
#ifdef DEBUG_PATHS
|
||||||
cout << "ct2ctml: executing the command " << cmd << endl;
|
writelog("ct2ctml: executing the command " + cmd + "\n");
|
||||||
#endif
|
#endif
|
||||||
int ierr = 0;
|
int ierr = 0;
|
||||||
try {
|
try {
|
||||||
|
|
@ -148,7 +152,7 @@ namespace ctml {
|
||||||
*/
|
*/
|
||||||
#if defined(CYGWIN)
|
#if defined(CYGWIN)
|
||||||
#ifdef DEBUG_PATHS
|
#ifdef DEBUG_PATHS
|
||||||
cout << "sleeping for 3 secs" << endl;
|
writelog("sleeping for 3 secs+\n");
|
||||||
#endif
|
#endif
|
||||||
cmd = "sleep 3";
|
cmd = "sleep 3";
|
||||||
try {
|
try {
|
||||||
|
|
@ -195,7 +199,8 @@ namespace ctml {
|
||||||
#else
|
#else
|
||||||
cmd = "rm -f " + path;
|
cmd = "rm -f " + path;
|
||||||
try {
|
try {
|
||||||
system(cmd.c_str());
|
if (ierr == 0)
|
||||||
|
system(cmd.c_str());
|
||||||
}
|
}
|
||||||
catch (...) { ; }
|
catch (...) { ; }
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -213,7 +218,7 @@ namespace ctml {
|
||||||
// find the input file on the Cantera search path
|
// find the input file on the Cantera search path
|
||||||
string inname = findInputFile(file);
|
string inname = findInputFile(file);
|
||||||
#ifdef DEBUG_PATHS
|
#ifdef DEBUG_PATHS
|
||||||
cout <<"Found file: " << inname << endl;
|
writelog("Found file: "+inname+"\n");
|
||||||
#endif
|
#endif
|
||||||
if (inname == "")
|
if (inname == "")
|
||||||
throw CanteraError("get_CTML_tree", "file "+file+" not found");
|
throw CanteraError("get_CTML_tree", "file "+file+" not found");
|
||||||
|
|
@ -234,7 +239,7 @@ namespace ctml {
|
||||||
ff = inname;
|
ff = inname;
|
||||||
}
|
}
|
||||||
#ifdef DEBUG_PATHS
|
#ifdef DEBUG_PATHS
|
||||||
cout << "Attempting to parse xml file " << ff << endl;
|
writelog("Attempting to parse xml file " + ff + "\n");
|
||||||
#endif
|
#endif
|
||||||
ifstream fin(ff.c_str());
|
ifstream fin(ff.c_str());
|
||||||
if (!fin) {
|
if (!fin) {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue