From a739eade8ee900a9a1e13cf4a35940e24dbea0f2 Mon Sep 17 00:00:00 2001 From: Don HO Date: Sun, 13 Oct 2019 21:48:27 +0200 Subject: [PATCH] Plugin list updater (in progress) --- PowerEditor/src/Notepad_plus.h | 11 +++++++++-- PowerEditor/src/Notepad_plus_Window.h | 5 +++++ .../WinControls/PluginsAdmin/pluginsAdmin.cpp | 7 +++++++ .../src/WinControls/PluginsAdmin/pluginsAdmin.h | 1 + PowerEditor/src/winmain.cpp | 17 ++++++++++++++--- 5 files changed, 36 insertions(+), 5 deletions(-) diff --git a/PowerEditor/src/Notepad_plus.h b/PowerEditor/src/Notepad_plus.h index 8d8a1459..565743f3 100644 --- a/PowerEditor/src/Notepad_plus.h +++ b/PowerEditor/src/Notepad_plus.h @@ -241,18 +241,25 @@ public: std::vector addNppComponents(const TCHAR *destDir, const TCHAR *extFilterName, const TCHAR *extFilter); std::vector addNppPlugins(const TCHAR *extFilterName, const TCHAR *extFilter); int getHtmlXmlEncoding(const TCHAR *fileName) const; + HACCEL getAccTable() const{ return _accelerator.getAccTable(); - } + }; + bool emergency(const generic_string& emergencySavedDir); + Buffer* getCurrentBuffer() { return _pEditView->getCurrentBuffer(); - } + }; + void launchDocumentBackupTask(); int getQuoteIndexFrom(const wchar_t* quoter) const; void showQuoteFromIndex(int index) const; void showQuote(const QuoteParams* quote) const; + generic_string getPluginListVerStr() const { + return _pluginsAdminDlg.getPluginListVerStr(); + }; private: Notepad_plus_Window *_pPublicInterface = nullptr; diff --git a/PowerEditor/src/Notepad_plus_Window.h b/PowerEditor/src/Notepad_plus_Window.h index 941c48e6..b3002d04 100644 --- a/PowerEditor/src/Notepad_plus_Window.h +++ b/PowerEditor/src/Notepad_plus_Window.h @@ -92,6 +92,11 @@ public: _isPrelaunch = val; } + generic_string getPluginListVerStr() const + { + return _notepad_plus_plus_core.getPluginListVerStr(); + } + virtual void destroy() { ::DestroyWindow(_hSelf); diff --git a/PowerEditor/src/WinControls/PluginsAdmin/pluginsAdmin.cpp b/PowerEditor/src/WinControls/PluginsAdmin/pluginsAdmin.cpp index 4a73cb22..dc967b96 100644 --- a/PowerEditor/src/WinControls/PluginsAdmin/pluginsAdmin.cpp +++ b/PowerEditor/src/WinControls/PluginsAdmin/pluginsAdmin.cpp @@ -439,6 +439,13 @@ PluginsAdminDlg::PluginsAdminDlg() #endif } +generic_string PluginsAdminDlg::getPluginListVerStr() const +{ + Version v; + v.setVersionFrom(_pluginListFullPath); + return v.toString(); +} + bool PluginsAdminDlg::exitToInstallRemovePlugins(Operation op, const vector& puis) { generic_string opStr; diff --git a/PowerEditor/src/WinControls/PluginsAdmin/pluginsAdmin.h b/PowerEditor/src/WinControls/PluginsAdmin/pluginsAdmin.h index 975f2e2d..133fcb5e 100644 --- a/PowerEditor/src/WinControls/PluginsAdmin/pluginsAdmin.h +++ b/PowerEditor/src/WinControls/PluginsAdmin/pluginsAdmin.h @@ -207,6 +207,7 @@ public : void changeTabName(LIST_TYPE index, const TCHAR *name2change); void changeColumnName(COLUMN_TYPE index, const TCHAR *name2change); + generic_string getPluginListVerStr() const; protected: virtual INT_PTR CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam); diff --git a/PowerEditor/src/winmain.cpp b/PowerEditor/src/winmain.cpp index c50e55d6..4568fa14 100644 --- a/PowerEditor/src/winmain.cpp +++ b/PowerEditor/src/winmain.cpp @@ -570,12 +570,23 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE, PWSTR pCmdLine, int) if (doUpdatePluginList) { // Update Plugin List - updaterParams += TEXT(" -upPL"); + generic_string upPlParams = TEXT("-v"); + upPlParams += notepad_plus_plus.getPluginListVerStr(); + + if (nppParameters.isx64()) + { + upPlParams += TEXT(" -px64"); + } + + upPlParams += TEXT(" -upZip"); // overrided "InfoUrl" in gup.xml - updaterParams += TEXT(" https://notepad-plus-plus.org/update/pluginListDownloadUrl.php"); + upPlParams += TEXT(" https://notepad-plus-plus.org/update/pluginListDownloadUrl.php"); - Process updater(updaterFullPath.c_str(), updaterParams.c_str(), updaterDir.c_str()); + // indicate the pluginList installation location + upPlParams += nppParameters.getPluginConfDir(); + + Process updater(updaterFullPath.c_str(), upPlParams.c_str(), updaterDir.c_str()); updater.run(); // TODO: Update next update date