Changeset 9661f81 in nscp for modules/CheckExternalScripts/CheckExternalScripts.cpp
- Timestamp:
- 05/10/10 22:17:31 (3 years ago)
- Branches:
- master, 0.4.0, 0.4.1, 0.4.2, stable
- Children:
- f40d813
- Parents:
- d1029bd
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
modules/CheckExternalScripts/CheckExternalScripts.cpp
r4580c6c r9661f81 64 64 } 65 65 FindClose(hFind); 66 } 67 68 69 std::wstring CheckExternalScripts::getWrapping(std::wstring val) { 70 strEx::token tok = strEx::getToken(val, ' ', true); 71 std::wstring::size_type pos = tok.first.find_last_of(_T(".")); 72 if (pos == std::wstring::npos) 73 return _T(""); 74 return tok.first.substr(pos+1); 75 } 76 77 void CheckExternalScripts::addWrappedCommand(std::wstring key, std::wstring tpl, std::wstring command ) { 78 strEx::token tok = strEx::getToken(command, ' ', true); 79 strEx::replace(tpl, _T("%SCRIPT%"), tok.first); 80 strEx::replace(tpl, _T("%ARGS%"), tok.second); 81 tok = strEx::getToken(tpl, ' ', true); 82 addCommand(key.c_str(),tok.first, tok.second); 66 83 } 67 84 … … 96 113 } 97 114 115 std::map<std::wstring,std::wstring> wrappers; 116 std::list<std::wstring> wrappings = NSCModuleHelper::getSettingsSection(EXTSCRIPT_WRAPPINGS_SECTION_TITLE); 117 for (it = wrappings.begin(); it != wrappings.end(); ++it) { 118 std::wstring val = NSCModuleHelper::getSettingsString(EXTSCRIPT_WRAPPINGS_SECTION_TITLE, *it, _T("")); 119 if (!(*it).empty() && !val.empty()) { 120 wrappers[(*it)] = val; 121 } 122 } 123 std::list<std::wstring> wscript = NSCModuleHelper::getSettingsSection(EXTSCRIPT_WRAPPED_SCRIPT_SECTION_TITLE); 124 for (it = wrappings.begin(); it != wscript.end(); ++it) { 125 std::wstring val = NSCModuleHelper::getSettingsString(EXTSCRIPT_WRAPPED_SCRIPT_SECTION_TITLE, *it, _T("")); 126 if (!(*it).empty() && !val.empty()) { 127 std::wstring type = getWrapping(val); 128 std::map<std::wstring,std::wstring>::const_iterator cit = wrappers.find(type); 129 if (cit == wrappers.end()) { 130 NSC_LOG_ERROR_STD(_T("Failed to find wrappings for: ") + type + _T(" (" + (*it) + _T(")"))); 131 } else { 132 addWrappedCommand((*it), (*cit).second, val); 133 } 134 } 135 } 136 98 137 if (!scriptDirectory_.empty()) { 99 138 addAllScriptsFrom(scriptDirectory_);
Note: See TracChangeset
for help on using the changeset viewer.








