| 320 | |
| 321 | |
| 322 | InstallStatus 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 |
no test coverage detected