| 67 | |
| 68 | |
| 69 | void Utility::startGpup(HWND errorParent, const TCHAR *nppDir, const TCHAR *arguments, bool /* needAdmin */) |
| 70 | { |
| 71 | |
| 72 | tstring gpupExe(nppDir); |
| 73 | gpupExe.append(_T("\\updater\\gpup.exe")); |
| 74 | |
| 75 | if (!::PathFileExists(gpupExe.c_str())) |
| 76 | { |
| 77 | ::MessageBox(errorParent, _T("A file needed by the plugin manager (gpup.exe) is not present under the updater directory. You should update or reinstall the Plugin Manager plugin to fix this problem. Notepad++ will not restart."), |
| 78 | _T("Notepad++ Plugin Manager"), MB_ICONERROR); |
| 79 | return; |
| 80 | } |
| 81 | |
| 82 | PluginVersion *gpupVersion = getFileVersion(gpupExe.c_str()); |
| 83 | |
| 84 | if ((*gpupVersion) < PluginVersion(PLUGINMANAGERVERSION_STRING)) |
| 85 | { |
| 86 | ::MessageBox(errorParent, _T("The external plugin updater (gpup.exe) under ") |
| 87 | _T("the updater directory does not appear to be the correct version. ") |
| 88 | _T("It will most likely work, but you should reinstall the ") |
| 89 | _T("plugin manager at your next opportunity to ensure full ") |
| 90 | _T("functionality. We'll attempt to use the current version ") |
| 91 | _T("for this operation."), |
| 92 | _T("Plugin Manager GPUP.EXE Version"), |
| 93 | MB_OK | MB_ICONWARNING); |
| 94 | } |
| 95 | delete gpupVersion; |
| 96 | //gpupExe.insert(0, _T("\"")); |
| 97 | //gpupExe.append(_T("\" ")); |
| 98 | |
| 99 | tstring gpupArguments(arguments); |
| 100 | |
| 101 | if (!gpupArguments.empty()) |
| 102 | gpupArguments.append(_T(" ")); |
| 103 | |
| 104 | tstring notepadExe; |
| 105 | TCHAR* notepadCmdLine = ::GetCommandLine(); |
| 106 | |
| 107 | TCHAR stopChar = _T(' '); |
| 108 | |
| 109 | if (*notepadCmdLine == _T('\"')) |
| 110 | { |
| 111 | ++notepadCmdLine; |
| 112 | stopChar = _T('\"'); |
| 113 | } |
| 114 | |
| 115 | while(*notepadCmdLine && *notepadCmdLine != stopChar) |
| 116 | { |
| 117 | notepadExe.push_back(*notepadCmdLine); |
| 118 | ++notepadCmdLine; |
| 119 | } |
| 120 | |
| 121 | |
| 122 | |
| 123 | gpupArguments.append(_T("-w \"Notepad++\" -e \"")); |
| 124 | gpupArguments.append(notepadExe); |
| 125 | gpupArguments.append(_T("\"")); |
| 126 |
nothing calls this directly
no test coverage detected