/** Removes all files froma login. * \param addon The addon to be removed. * \return True if uninstallation was successful. */ bool AddonsManager::uninstall(const Addon &addon) { std::cout << "[addons] Uninstalling <" << core::stringc(addon.getName()).c_str() << ">\n"; // addon is a const reference, and to avoid removing the const, we // find the proper index again to modify the installed state int index = getAddonIndex(addon.getId()); assert(index>=0 && index < (int)m_addons_list.getData().size()); m_addons_list.getData()[index].setInstalled(false); //remove the addons directory bool error = false; // if the user deleted the data directory for an add-on with // filesystem tools, removeTrack/removeKart will trigger an assert // because the kart/track was never added in the first place if (file_manager->fileExists(addon.getDataDir())) { error = !file_manager->removeDirectory(addon.getDataDir()); if(addon.getType()=="kart") { kart_properties_manager->removeKart(addon.getId()); } else if(addon.getType()=="track" || addon.getType()=="arena") { track_manager->removeTrack(addon.getId()); } } saveInstalled(); return !error; } // uninstall
/** Removes all files froma login. * \param addon The addon to be removed. * \return True if uninstallation was successful. */ bool AddonsManager::uninstall(const Addon &addon) { std::cout << "[addons] Uninstalling <" << core::stringc(addon.getName()).c_str() << ">\n"; // addon is a const reference, and to avoid removing the const, we // find the proper index again to modify the installed state int index = getAddonIndex(addon.getId()); assert(index>=0 && index < (int)m_addons_list.getData().size()); m_addons_list.getData()[index].setInstalled(false); //remove the addons directory bool error = !file_manager->removeDirectory(addon.getDataDir()); if(addon.getType()=="kart") { kart_properties_manager->removeKart(addon.getId()); } else if(addon.getType()=="track" || addon.getType()=="arena") { track_manager->removeTrack(addon.getId()); } saveInstalled(); return !error; } // uninstall