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

Method remove

pluginManager/src/Plugin.cpp:322–360  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

320
321
322InstallStatus Plugin::remove(tstring& basePath, TiXmlElement* forGpup,
323 std::function<void(const TCHAR*)> setStatus,
324 std::function<void(const int)> stepProgress,
325 std::function<void()> stepComplete,
326 const ModuleInfo* moduleInfo,
327 VariableHandler* variableHandler,
328 CancelToken& cancelToken)
329{
330
331 TiXmlElement* deleteElement = new TiXmlElement(_T("delete"));
332
333
334 // Save a copy of the current plugin dir
335 const tstring& origPluginDir = variableHandler->getVariable(_T("PLUGINDIR"));
336
337 // replace PLUGINDIR with the plugin dir of this plugin
338 if (this->getInstalledForAllUsers())
339 {
340 variableHandler->setVariable(_T("PLUGINDIR"), (variableHandler->getVariable(_T("ALLUSERSPLUGINDIR")).c_str()));
341 }
342 else
343 {
344 variableHandler->setVariable(_T("PLUGINDIR"), (variableHandler->getVariable(_T("USERPLUGINDIR")).c_str()));
345 }
346
347 tstring fullFilename(variableHandler->getVariable(_T("PLUGINDIR")));
348 fullFilename.push_back(_T('\\'));
349 fullFilename.append(getFilename());
350 deleteElement->SetAttribute(_T("file"), fullFilename.c_str());
351
352 forGpup->LinkEndChild(deleteElement);
353
354 runSteps(_removeSteps, basePath, forGpup, setStatus, stepProgress, stepComplete, moduleInfo, variableHandler, cancelToken);
355
356 // restore the original plugin dir
357 variableHandler->setVariable(_T("PLUGINDIR"), origPluginDir.c_str());
358
359 return INSTALL_NEEDRESTART;
360}
361
362
363

Callers 1

removePluginsMethod · 0.45

Calls 6

setVariableMethod · 0.80
c_strMethod · 0.80
LinkEndChildMethod · 0.80
appendMethod · 0.45
SetAttributeMethod · 0.45

Tested by

no test coverage detected