* @brief Try to load a plugin * * @return 1 if loaded plugin successfully, negatives for errors */
| 695 | * @return 1 if loaded plugin successfully, negatives for errors |
| 696 | */ |
| 697 | int PluginInfo::LoadPlugin(const String & scriptletFilepath) |
| 698 | { |
| 699 | // Search for the class "WinMergeScript" |
| 700 | LPDISPATCH lpDispatch = CreateDispatchBySource(scriptletFilepath.c_str(), L"WinMergeScript"); |
| 701 | if (lpDispatch == nullptr) |
| 702 | { |
| 703 | // set up object in case we need to log info |
| 704 | ScriptInfo scinfo(scriptletFilepath); |
| 705 | scinfo.Log(_T("WinMergeScript entry point not found")); |
| 706 | return -10; // error |
| 707 | } |
| 708 | |
| 709 | return MakeInfo(scriptletFilepath, paths::FindFileName(scriptletFilepath), lpDispatch); |
| 710 | } |
| 711 | |
| 712 | static void ReportPluginLoadFailure(const String & scriptletFilepath, const SE_Exception& se) |
| 713 | { |
no test coverage detected