MCPcopy Create free account
hub / github.com/WinMerge/winmerge / GetAvailableScripts

Function GetAvailableScripts

Src/Plugins.cpp:902–948  ·  view source on GitHub ↗

* @brief Get available scriptlets for an event * * @return Returns an array of valid LPDISPATCH */

Source from the content-addressed store, hash-verified

900 * @return Returns an array of valid LPDISPATCH
901 */
902static std::map<String, PluginArrayPtr> GetAvailableScripts()
903{
904 vector<String>& scriptlets = LoadTheScriptletList();
905 std::map<std::wstring, PluginArrayPtr> plugins;
906
907 std::list<String> badScriptlets;
908 for (size_t i = 0; i < scriptlets.size(); i++)
909 {
910 // Note all the info about the plugin
911 PluginInfoPtr plugin(new PluginInfo);
912
913 String scriptletFilepath = scriptlets.at(i);
914 int rtn = LoadPluginWrapper(*plugin.get(), scriptletFilepath);
915 if (rtn == 1)
916 {
917 // Plugin has this event
918 if (plugins.find(plugin->m_event) == plugins.end())
919 plugins[plugin->m_event].reset(new PluginArray);
920 plugins[plugin->m_event]->push_back(plugin);
921 }
922 else if (rtn < 0)
923 {
924 // Plugin is bad
925 badScriptlets.push_back(scriptletFilepath);
926 }
927 }
928
929 if (CAllThreadsScripts::GetInternalPluginsLoader())
930 {
931 String errmsg;
932 if (!CAllThreadsScripts::GetInternalPluginsLoader()(plugins, errmsg))
933 AppErrorMessageBox(errmsg);
934 }
935
936 // Remove any bad plugins from the cache
937 // This might be a good time to see if the user wants to abort or continue
938 while (!badScriptlets.empty())
939 {
940 RemoveScriptletCandidate(badScriptlets.front());
941 badScriptlets.pop_front();
942 }
943
944 ResolveNameConflict(plugins);
945 LoadCustomSettings(plugins);
946
947 return plugins;
948}
949
950static void FreeAllScripts(PluginArrayPtr& pArray)
951{

Callers 5

GetAvailableScriptsMethod · 0.85
SaveSettingsMethod · 0.85
ReloadAllScriptsMethod · 0.85
GetPluginByNameMethod · 0.85

Calls 14

LoadPluginWrapperFunction · 0.85
RemoveScriptletCandidateFunction · 0.85
ResolveNameConflictFunction · 0.85
LoadCustomSettingsFunction · 0.85
pop_frontMethod · 0.80
AppErrorMessageBoxFunction · 0.70
sizeMethod · 0.45
atMethod · 0.45
getMethod · 0.45
findMethod · 0.45
endMethod · 0.45
resetMethod · 0.45

Tested by

no test coverage detected