Changeset 3360 for code/branches/resource/src/core/TclBind.cc
- Timestamp:
- Jul 28, 2009, 5:04:38 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/resource/src/core/TclBind.cc
r3354 r3360 104 104 Tcl::interpreter* TclBind::createTclInterpreter() 105 105 { 106 Tcl::interpreter* interpreter; 106 Tcl::interpreter* interpreter = new Tcl::interpreter(); 107 std::string libpath = TclBind::getTclLibraryPath(); 108 109 try 110 { 111 if (libpath != "") 112 interpreter->eval("set tcl_library \"" + libpath + "\""); 113 114 Tcl_Init(interpreter->get()); 115 116 interpreter->eval("source \"" + TclBind::getInstance().tclDataPath_ + "/init.tcl\""); 117 } 118 catch (Tcl::tcl_error const &e) 119 { COUT(1) << "Tcl error while creating Tcl-interpreter: " << e.what() << std::endl; COUT(1) << "Error: Tcl isn't properly initialized. Orxonox might possibly not work like that." << std::endl; } 120 catch (std::exception const &e) 121 { COUT(1) << "Error while creating Tcl-interpreter: " << e.what() << std::endl; COUT(1) << "Error: Tcl isn't properly initialized. Orxonox might possibly not work like that." << std::endl; } 122 catch (...) 123 { COUT(1) << "Error while creating Tcl-interpreter." << std::endl; COUT(1) << "Error: Tcl isn't properly initialized. Orxonox might possibly not work like that." << std::endl; } 124 125 return interpreter; 126 } 127 128 std::string TclBind::getTclLibraryPath() 129 { 107 130 #ifdef DEPENDENCY_PACKAGE_ENABLE 108 131 if (Core::isDevelopmentRun()) 109 interpreter = new Tcl::interpreter(std::string(ORXONOX_DEP_LIB_PATH) + "/tcl");132 return (std::string(ORXONOX_DEP_LIB_PATH) + "/tcl"); 110 133 else 111 interpreter = new Tcl::interpreter(Core::getRootPathString() + "lib/tcl");134 return (Core::getRootPathString() + "lib/tcl"); 112 135 #else 113 interpreter = new Tcl::interpreter();136 return ""; 114 137 #endif 115 try116 {117 interpreter->eval("source \"" + TclBind::getInstance().tclDataPath_ + "/init.tcl\"");118 }119 catch (Tcl::tcl_error const &e)120 { COUT(1) << "Tcl error while creating Tcl-interpreter: " << e.what() << std::endl; }121 catch (std::exception const &e)122 { COUT(1) << "Error while creating Tcl-interpreter: " << e.what() << std::endl; }123 catch (...)124 { COUT(1) << "Error while creating Tcl-interpreter." << std::endl; }125 126 return interpreter;127 138 } 128 139
Note: See TracChangeset
for help on using the changeset viewer.