diff --git a/SConstruct b/SConstruct index 85a2805b9..0680ae53e 100644 --- a/SConstruct +++ b/SConstruct @@ -1073,6 +1073,10 @@ if 'install' in COMMAND_LINE_TARGETS: # Data files install('$inst_datadir', mglob(env, pjoin('data','inputs'), 'cti', 'xml')) + # Converter scripts + install('$inst_bindir', 'interfaces/python/ck2cti.py') + install('$inst_bindir', 'interfaces/python/ctml_writer.py') + ### List of libraries needed to link to Cantera ### linkLibs = ['cantera'] linkSharedLibs = ['cantera_shared'] diff --git a/src/base/application.cpp b/src/base/application.cpp index c18ddd866..0be77c8fb 100644 --- a/src/base/application.cpp +++ b/src/base/application.cpp @@ -648,11 +648,24 @@ void Application::setDefaultDirectories() // 'templates' subdirectories of the main installation directory. std::string installDir; - readStringRegistryKey("SOFTWARE\\Cantera\\Cantera 2.0", "InstallDir", installDir, ""); - if (installDir != "") { - dirs.push_back(installDir + "data"); - dirs.push_back(installDir + "templates"); + readStringRegistryKey("SOFTWARE\\Cantera\\Cantera 2.0", + "InstallDir", installDir, ""); + if (installDir == "") { + return; } + dirs.push_back(installDir + "data"); + dirs.push_back(installDir + "templates"); + + // Scripts for converting mechanisms to CTI and CMTL formats are installed + // In the 'bin' subdirectory. Add that directory to the PYTHONPATH. + const char* old_pythonpath = getenv("PYTHONPATH"); + std::string pythonpath = "PYTHONPATH=" + installDir + "\\bin"; + if (old_pythonpath) { + pythonpath += ";"; + pythonpath.append(old_pythonpath); + } + putenv(pythonpath.c_str()); + #endif #ifdef DARWIN