diff --git a/PowerEditor/src/MISC/PluginsManager/PluginsManager.cpp b/PowerEditor/src/MISC/PluginsManager/PluginsManager.cpp index f94371e07..c2b4059ca 100644 --- a/PowerEditor/src/MISC/PluginsManager/PluginsManager.cpp +++ b/PowerEditor/src/MISC/PluginsManager/PluginsManager.cpp @@ -345,30 +345,44 @@ bool PluginsManager::loadPlugins(const TCHAR *dir) bool PluginsManager::loadPluginsV2(const TCHAR* dir) { - if (_isDisabled || !dir || !dir[0]) + if (_isDisabled) return false; - NppParameters * nppParams = NppParameters::getInstance(); vector dllNames; vector dll2Remove; - generic_string pluginsFolderFilter = dir; + NppParameters * nppParams = NppParameters::getInstance(); + generic_string nppPath = nppParams->getNppPath(); + + generic_string pluginsFolder; + if (dir && dir[0]) + { + pluginsFolder = dir; + } + else + { + pluginsFolder = nppPath; + PathAppend(pluginsFolder, TEXT("plugins")); + } + generic_string pluginsFolderFilter = pluginsFolder; PathAppend(pluginsFolderFilter, TEXT("*.*")); - + WIN32_FIND_DATA foundData; + printStr(pluginsFolder.c_str()); HANDLE hFindFolder = ::FindFirstFile(pluginsFolderFilter.c_str(), &foundData); HANDLE hFindDll = INVALID_HANDLE_VALUE; // get plugin folder if (hFindFolder != INVALID_HANDLE_VALUE && (foundData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) { - generic_string pluginsFullPathFilter = dir; + generic_string pluginsFullPathFilter = pluginsFolder; PathAppend(pluginsFullPathFilter, foundData.cFileName); generic_string pluginsFolderPath = pluginsFullPathFilter; generic_string dllName = foundData.cFileName; dllName += TEXT(".dll"); PathAppend(pluginsFullPathFilter, dllName); + printStr(pluginsFullPathFilter.c_str()); // get plugin hFindDll = ::FindFirstFile(pluginsFullPathFilter.c_str(), &foundData); @@ -383,13 +397,13 @@ bool PluginsManager::loadPluginsV2(const TCHAR* dir) // get plugin folder while (::FindNextFile(hFindFolder, &foundData)) { - generic_string pluginsFullPathFilter2 = dir; + generic_string pluginsFullPathFilter2 = pluginsFolder; PathAppend(pluginsFullPathFilter2, foundData.cFileName); generic_string pluginsFolderPath2 = pluginsFullPathFilter2; generic_string dllName2 = foundData.cFileName; dllName2 += TEXT(".dll"); PathAppend(pluginsFullPathFilter2, dllName2); - + printStr(pluginsFullPathFilter2.c_str()); // get plugin hFindDll = ::FindFirstFile(pluginsFullPathFilter2.c_str(), &foundData); if (hFindDll != INVALID_HANDLE_VALUE && !(foundData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) diff --git a/PowerEditor/src/MISC/PluginsManager/PluginsManager.h b/PowerEditor/src/MISC/PluginsManager/PluginsManager.h index b2c48fdf2..141417654 100644 --- a/PowerEditor/src/MISC/PluginsManager/PluginsManager.h +++ b/PowerEditor/src/MISC/PluginsManager/PluginsManager.h @@ -101,7 +101,7 @@ public: int loadPlugin(const TCHAR *pluginFilePath, std::vector & dll2Remove); bool loadPlugins(const TCHAR *dir = NULL); - bool loadPluginsV2(const TCHAR *dir); + bool loadPluginsV2(const TCHAR *dir = NULL); bool unloadPlugin(int index, HWND nppHandle); diff --git a/PowerEditor/src/Notepad_plus.cpp b/PowerEditor/src/Notepad_plus.cpp index bebfbfae2..c187fa0d3 100644 --- a/PowerEditor/src/Notepad_plus.cpp +++ b/PowerEditor/src/Notepad_plus.cpp @@ -415,6 +415,7 @@ LRESULT Notepad_plus::init(HWND hwnd) // Load plugins from its installation directory. // All loaded dll will be ignored _pluginsManager.loadPlugins(); + _pluginsManager.loadPluginsV2(); _restoreButton.init(_pPublicInterface->getHinst(), hwnd);