Shift the post installation (checking if the plugin is deployed correctely) responsability to WinGup

For the sake of retro-compatibility, change the way of plugin packaging:
1. The plugin DLL file should be placed at the root level of the ZIP file. It has to be the only DLL file on this level.
2. The root level of the ZIP file can also contain additional files and folders which will be copied to the users harddisk as well.
3. Everything what gets copied from the ZIP file will be stored under <Npp-installation-folder>\plugins\<plugin-name>.
pull/4925/head
Don HO 2018-10-29 20:21:15 +01:00
parent b01a396668
commit ab8b5dc7a0
1 changed files with 9 additions and 11 deletions

View File

@ -497,16 +497,13 @@ DWORD WINAPI PluginsAdminDlg::launchPluginInstallerThread(void* params)
if (result == 0) // wingup return 0 -> OK if (result == 0) // wingup return 0 -> OK
{ {
generic_string installedPluginFolder = lwp->_nppPluginsDir; generic_string installedPluginPath = lwp->_nppPluginsDir;
PathAppend(installedPluginFolder, lwp->_pluginUpdateInfo->_folderName);
generic_string installedPluginPath = installedPluginFolder;
PathAppend(installedPluginPath, lwp->_pluginUpdateInfo->_folderName + TEXT(".dll")); PathAppend(installedPluginPath, lwp->_pluginUpdateInfo->_folderName + TEXT(".dll"));
// check installed dll // check installed dll
if (!::PathFileExists(installedPluginPath.c_str())) if (!::PathFileExists(installedPluginPath.c_str()))
{ {
// Remove installed plugin // Problem: Remove installed plugin
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker(); NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker();
pNativeSpeaker->messageBox("PluginBuiltWronglyCannotFound", pNativeSpeaker->messageBox("PluginBuiltWronglyCannotFound",
NULL, NULL,
@ -516,7 +513,7 @@ DWORD WINAPI PluginsAdminDlg::launchPluginInstallerThread(void* params)
0, 0,
lwp->_pluginUpdateInfo->_displayName.c_str()); lwp->_pluginUpdateInfo->_displayName.c_str());
deleteFileOrFolder(installedPluginFolder); deleteFileOrFolder(lwp->_nppPluginsDir);
return FALSE; return FALSE;
} }
@ -559,17 +556,18 @@ bool PluginsAdminDlg::installPlugins()
vector<size_t> indexes = _availableList.getCheckedIndexes(); vector<size_t> indexes = _availableList.getCheckedIndexes();
vector<PluginUpdateInfo*> puis = _availableList.fromUiIndexesToPluginInfos(indexes); vector<PluginUpdateInfo*> puis = _availableList.fromUiIndexesToPluginInfos(indexes);
generic_string nppPluginsDir = getPluginsPath(); generic_string nppPluginsHome = getPluginsPath();
generic_string quoted_nppPluginsDir = TEXT("\"");
quoted_nppPluginsDir += nppPluginsDir;
quoted_nppPluginsDir += TEXT("\"");
HANDLE mutex = ::CreateMutex(NULL, false, TEXT("nppPluginInstaller")); HANDLE mutex = ::CreateMutex(NULL, false, TEXT("nppPluginInstaller"));
for (auto i : puis) for (auto i : puis)
{ {
generic_string updaterParams = TEXT("-unzipTo "); generic_string updaterParams = TEXT("-unzipTo ");
generic_string nppPluginsDir = nppPluginsHome;
PathAppend(nppPluginsDir, i->_folderName);
generic_string quoted_nppPluginsDir = TEXT("\"");
quoted_nppPluginsDir += nppPluginsDir;
quoted_nppPluginsDir += TEXT("\"");
updaterParams += quoted_nppPluginsDir; updaterParams += quoted_nppPluginsDir;
// add zipFile's url // add zipFile's url