From ab8b5dc7a0d3e41d54da13f851ff197fa39ed758 Mon Sep 17 00:00:00 2001 From: Don HO <don.h@free.fr> Date: Mon, 29 Oct 2018 20:21:15 +0100 Subject: [PATCH] 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>. --- .../WinControls/PluginsAdmin/pluginsAdmin.cpp | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/PowerEditor/src/WinControls/PluginsAdmin/pluginsAdmin.cpp b/PowerEditor/src/WinControls/PluginsAdmin/pluginsAdmin.cpp index 18c2fcea3..4a440d929 100644 --- a/PowerEditor/src/WinControls/PluginsAdmin/pluginsAdmin.cpp +++ b/PowerEditor/src/WinControls/PluginsAdmin/pluginsAdmin.cpp @@ -497,16 +497,13 @@ DWORD WINAPI PluginsAdminDlg::launchPluginInstallerThread(void* params) if (result == 0) // wingup return 0 -> OK { - generic_string installedPluginFolder = lwp->_nppPluginsDir; - PathAppend(installedPluginFolder, lwp->_pluginUpdateInfo->_folderName); - - generic_string installedPluginPath = installedPluginFolder; + generic_string installedPluginPath = lwp->_nppPluginsDir; PathAppend(installedPluginPath, lwp->_pluginUpdateInfo->_folderName + TEXT(".dll")); // check installed dll if (!::PathFileExists(installedPluginPath.c_str())) { - // Remove installed plugin + // Problem: Remove installed plugin NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker(); pNativeSpeaker->messageBox("PluginBuiltWronglyCannotFound", NULL, @@ -516,7 +513,7 @@ DWORD WINAPI PluginsAdminDlg::launchPluginInstallerThread(void* params) 0, lwp->_pluginUpdateInfo->_displayName.c_str()); - deleteFileOrFolder(installedPluginFolder); + deleteFileOrFolder(lwp->_nppPluginsDir); return FALSE; } @@ -559,17 +556,18 @@ bool PluginsAdminDlg::installPlugins() vector<size_t> indexes = _availableList.getCheckedIndexes(); vector<PluginUpdateInfo*> puis = _availableList.fromUiIndexesToPluginInfos(indexes); - generic_string nppPluginsDir = getPluginsPath(); - - generic_string quoted_nppPluginsDir = TEXT("\""); - quoted_nppPluginsDir += nppPluginsDir; - quoted_nppPluginsDir += TEXT("\""); + generic_string nppPluginsHome = getPluginsPath(); HANDLE mutex = ::CreateMutex(NULL, false, TEXT("nppPluginInstaller")); for (auto i : puis) { 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; // add zipFile's url