MCPcopy Create free account
hub / github.com/bruderstein/nppPluginManager / startupChecks

Function startupChecks

pluginManager/src/PluginManager.cpp:345–409  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

343
344
345UINT startupChecks(LPVOID /*param*/)
346{
347 TCHAR tConfigPath[MAX_PATH];
348 TCHAR tNppPath[MAX_PATH];
349 ::SendMessage(nppData._nppHandle, NPPM_GETPLUGINSCONFIGDIR, MAX_PATH, reinterpret_cast<LPARAM>(tConfigPath));
350 ::SendMessage(nppData._nppHandle, NPPM_GETNPPDIRECTORY, MAX_PATH, reinterpret_cast<LPARAM>(tNppPath));
351
352
353 tstring configPathVar = tConfigPath;
354 configPathVar.append(_T("\\PluginManagerGpup.xml"));
355 TiXmlDocument gpupDoc(configPathVar);
356 if (gpupDoc.LoadFile()
357 && gpupDoc.FirstChildElement(_T("install"))
358 && !gpupDoc.FirstChildElement(_T("install"))->NoChildren())
359 {
360 int mbResult = ::MessageBox(nppData._nppHandle, _T("There are still some pending actions to complete installing or removing some plugins. Would you like to do these now (Notepad++ will be restarted)?"),
361 _T("Notepad++ Plugin Manager"), MB_YESNO | MB_ICONEXCLAMATION);
362 if (mbResult == IDYES)
363 {
364 configPathVar.insert(0, _T("-a \""));
365 configPathVar.append(_T("\""));
366 Utility::startGpup(nppData._nppHandle, tNppPath, configPathVar.c_str(), TRUE);
367 }
368
369 }
370 else
371 {
372 // Clean up temp directory
373 tstring tempDir = tConfigPath;
374 tempDir.append(_T("\\plugin_install_temp"));
375 Utility::removeDirectory(tempDir.c_str());
376
377 // Remove the Gpup file (if it exists, doesn't matter if it doesn't)
378 ::DeleteFile(configPathVar.c_str());
379 }
380
381
382 time_t ltime;
383 time(&ltime);
384
385 if (g_options.notifyUpdates && ((ltime - g_options.lastCheck) > (86400 * g_options.daysToCheck)))
386 {
387 // Store the check time
388 TCHAR tmp[20];
389 _ltot_s((long)ltime, tmp, 20, 10);
390 ::WritePrivateProfileString(SETTINGS_GROUP, KEY_LASTCHECK, tmp, iniFilePath);
391
392 g_pluginList = new PluginList();
393 g_pluginList->init(&nppData);
394 pluginManagerDlg.setPluginList(g_pluginList);
395
396 g_pluginList->downloadList();
397 if (!g_pluginList->getUpdateablePlugins().empty())
398 {
399 notifyUpdatesDlg.init((HINSTANCE)g_hModule, nppData, g_pluginList);
400
401 // Check if there updates that we are not ignoring
402 if (notifyUpdatesDlg.updatesAvailable())

Callers

nothing calls this directly

Calls 11

NoChildrenMethod · 0.80
c_strMethod · 0.80
setPluginListMethod · 0.80
downloadListMethod · 0.80
updatesAvailableMethod · 0.80
appendMethod · 0.45
LoadFileMethod · 0.45
FirstChildElementMethod · 0.45
initMethod · 0.45
emptyMethod · 0.45
doModalMethod · 0.45

Tested by

no test coverage detected