Changeset df0ab60 in nscp for NSClient++.cpp
- Timestamp:
- 11/21/07 21:53:18 (6 years ago)
- Branches:
- master, 0.4.0, 0.4.1, 0.4.2, stable
- Children:
- 58a724d
- Parents:
- 5044c09
- File:
-
- 1 edited
-
NSClient++.cpp (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
NSClient++.cpp
r5044c09 rdf0ab60 106 106 } else if ( _stricmp( "noboot", argv[1]+1 ) == 0 ) { 107 107 g_bConsoleLog = true; 108 mainClient.enableDebug(true); 108 109 int nRetCode = -1; 109 110 if (argc>=4) … … 181 182 try { 182 183 Settings::getInstance()->setFile(getBasePath(), "NSC.ini"); 184 if (debug_) { 185 Settings::getInstance()->setInt("log", "debug", 1); 186 } 183 187 } catch (SettingsException e) { 184 188 LOG_ERROR_STD("Could not find settings: " + e.getMessage()); … … 187 191 LOG_ERROR_STD("Unknown exception reading settings..."); 188 192 return false; 189 }190 if (debug_) {191 Settings::getInstance()->setInt("log", "debug", 1);192 193 } 193 194 … … 201 202 return false; 202 203 } 203 204 SettingsT::sectionList list = Settings::getInstance()->getSection("modules"); 205 for (SettingsT::sectionList::iterator it = list.begin(); it != list.end(); it++) { 206 try { 207 loadPlugin(getBasePath() + "modules\\" + (*it)); 208 } catch(const NSPluginException& e) { 209 LOG_ERROR_STD("Exception raised: " + e.error_ + " in module: " + e.file_); 210 return false; 211 } catch (...) { 212 LOG_ERROR_STD("Unknown exception loading plugin: " + (*it)); 213 return false; 214 } 204 try { 205 SettingsT::sectionList list = Settings::getInstance()->getSection("modules"); 206 for (SettingsT::sectionList::iterator it = list.begin(); it != list.end(); it++) { 207 try { 208 loadPlugin(getBasePath() + "modules\\" + (*it)); 209 } catch(const NSPluginException& e) { 210 LOG_ERROR_STD("Exception raised: " + e.error_ + " in module: " + e.file_); 211 return false; 212 } catch (...) { 213 LOG_ERROR_STD("Unknown exception loading plugin: " + (*it)); 214 return false; 215 } 216 } 217 } catch (SettingsException e) { 218 NSC_LOG_ERROR_STD("Failed to set settings file" + e.getMessage()); 215 219 } 216 220 try { … … 472 476 static status d = unknown; 473 477 if (d == unknown) { 474 if (Settings::getInstance()->getInt("log", "debug", 0) == 1) 478 try { 479 if (Settings::getInstance()->getInt("log", "debug", 0) == 1) 480 d = debug; 481 else 482 d = nodebug; 483 } catch (SettingsException e) { 475 484 d = debug; 476 else 477 d = nodebug; 485 } 478 486 } 479 487 return (d == debug); … … 554 562 basePath = path.substr(0, pos) + "\\"; 555 563 delete [] buffer; 556 Settings::getInstance()->setFile(basePath, "NSC.ini"); 564 try { 565 Settings::getInstance()->setFile(basePath, "NSC.ini"); 566 } catch (SettingsException e) { 567 NSC_LOG_ERROR_STD("Failed to set settings file" + e.getMessage()); 568 } 557 569 return basePath; 558 570 } … … 563 575 } 564 576 int NSAPIGetSettingsInt(const char* section, const char* key, int defaultValue) { 565 return Settings::getInstance()->getInt(section, key, defaultValue); 577 try { 578 return Settings::getInstance()->getInt(section, key, defaultValue); 579 } catch (SettingsException e) { 580 NSC_LOG_ERROR_STD("Failed to set settings file" + e.getMessage()); 581 } 566 582 } 567 583 NSCAPI::errorReturn NSAPIGetBasePath(char*buffer, unsigned int bufLen) {
Note: See TracChangeset
for help on using the changeset viewer.








