diff --git a/PowerEditor/src/MISC/PluginsManager/PluginsManager.cpp b/PowerEditor/src/MISC/PluginsManager/PluginsManager.cpp index b30430cd..5158e36c 100644 --- a/PowerEditor/src/MISC/PluginsManager/PluginsManager.cpp +++ b/PowerEditor/src/MISC/PluginsManager/PluginsManager.cpp @@ -319,46 +319,53 @@ bool PluginsManager::loadPluginsV2(const TCHAR* dir) // get plugin folder if (hFindFolder != INVALID_HANDLE_VALUE && (foundData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) { - generic_string pluginsFullPathFilter = pluginsFolder; - PathAppend(pluginsFullPathFilter, foundData.cFileName); - generic_string pluginsFolderPath = pluginsFullPathFilter; - generic_string dllName = foundData.cFileName; - dllName += TEXT(".dll"); - PathAppend(pluginsFullPathFilter, dllName); - - // get plugin - hFindDll = ::FindFirstFile(pluginsFullPathFilter.c_str(), &foundData); - if (hFindDll != INVALID_HANDLE_VALUE && !(foundData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) + generic_string foundFileName = foundData.cFileName; + if (foundFileName != TEXT(".") && foundFileName != TEXT("..")) { - dllNames.push_back(pluginsFullPathFilter); + generic_string pluginsFullPathFilter = pluginsFolder; + PathAppend(pluginsFullPathFilter, foundFileName); + generic_string pluginsFolderPath = pluginsFullPathFilter; + generic_string dllName = foundFileName; + dllName += TEXT(".dll"); + PathAppend(pluginsFullPathFilter, dllName); - PluginList & pl = nppParams->getPluginList(); - pl.add(foundData.cFileName, false); + // get plugin + hFindDll = ::FindFirstFile(pluginsFullPathFilter.c_str(), &foundData); + if (hFindDll != INVALID_HANDLE_VALUE && !(foundData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) + { + dllNames.push_back(pluginsFullPathFilter); + + PluginList & pl = nppParams->getPluginList(); + pl.add(foundFileName, false); + } } - // get plugin folder while (::FindNextFile(hFindFolder, &foundData)) { - generic_string pluginsFullPathFilter2 = pluginsFolder; - PathAppend(pluginsFullPathFilter2, foundData.cFileName); - generic_string pluginsFolderPath2 = pluginsFullPathFilter2; - generic_string dllName2 = foundData.cFileName; - dllName2 += TEXT(".dll"); - PathAppend(pluginsFullPathFilter2, dllName2); - - // get plugin - if (hFindDll) + generic_string foundFileName2 = foundData.cFileName; + if (foundFileName2 != TEXT(".") && foundFileName2 != TEXT("..")) { - ::FindClose(hFindDll); - hFindDll = INVALID_HANDLE_VALUE; - } - hFindDll = ::FindFirstFile(pluginsFullPathFilter2.c_str(), &foundData); - if (hFindDll != INVALID_HANDLE_VALUE && !(foundData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) - { - dllNames.push_back(pluginsFullPathFilter2); + generic_string pluginsFullPathFilter2 = pluginsFolder; + PathAppend(pluginsFullPathFilter2, foundFileName2); + generic_string pluginsFolderPath2 = pluginsFullPathFilter2; + generic_string dllName2 = foundFileName2; + dllName2 += TEXT(".dll"); + PathAppend(pluginsFullPathFilter2, dllName2); - PluginList & pl = nppParams->getPluginList(); - pl.add(foundData.cFileName, false); + // get plugin + if (hFindDll) + { + ::FindClose(hFindDll); + hFindDll = INVALID_HANDLE_VALUE; + } + hFindDll = ::FindFirstFile(pluginsFullPathFilter2.c_str(), &foundData); + if (hFindDll != INVALID_HANDLE_VALUE && !(foundData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) + { + dllNames.push_back(pluginsFullPathFilter2); + + PluginList & pl = nppParams->getPluginList(); + pl.add(foundFileName2, false); + } } }