Remove previous addon directory after uninstall

This commit is contained in:
Benau 2019-12-17 07:37:50 +08:00
parent 4a2def8df1
commit 344079deda

View File

@ -486,7 +486,6 @@ bool AddonsManager::anyAddonsInstalled() const
*/
bool AddonsManager::install(const Addon &addon)
{
file_manager->checkAndCreateDirForAddons(addon.getDataDir());
//extract the zip in the addons folder called like the addons name
std::string base_name = StringUtils::getBasename(addon.getZipFileName());
@ -495,6 +494,11 @@ bool AddonsManager::install(const Addon &addon)
// Remove old addon first (including non official way to install addons)
AddonsPack::uninstallByName(addon.getDirName(), true/*force_clear*/);
if (file_manager->isDirectory(to))
file_manager->removeDirectory(to);
file_manager->checkAndCreateDirForAddons(to);
bool success = extract_zip(from, to, true/*recursive*/);
if (!success)
{