Commit 372a6c97 authored by Filipe Marques's avatar Filipe Marques
Browse files

changes in Mhwd file

parent 3754935c
......@@ -552,6 +552,7 @@ MHWD::STATUS Mhwd::installConfig(std::shared_ptr<Config> config)
MHWD::STATUS Mhwd::uninstallConfig(Config *config)
{
std::shared_ptr<Config> installedConfig{getInstalledConfig(config->name_, config->type_)};
std::vector<std::shared_ptr<Config>> localRequirements{data_.getAllLocalRequirements(installedConfig)};
// Check if installed
if (nullptr == installedConfig)
......@@ -564,21 +565,25 @@ MHWD::STATUS Mhwd::uninstallConfig(Config *config)
}
else
{
// TODO: Should we check for local requirements here?
// Run script
if (!runScript(installedConfig, MHWD::TRANSACTIONTYPE::REMOVE))
// Should we check for local requirements here?
if(!localRequirements.empty())
{
return MHWD::STATUS::ERROR_SCRIPT_FAILED;
}
// Run script
if (!runScript(installedConfig, MHWD::TRANSACTIONTYPE::REMOVE))
{
return MHWD::STATUS::ERROR_SCRIPT_FAILED;
}
if (!removeDirectory(installedConfig->basePath_))
{
return MHWD::STATUS::ERROR_SET_DATABASE;
if (!removeDirectory(installedConfig->basePath_))
{
return MHWD::STATUS::ERROR_SET_DATABASE;
}
}
// Installed config vectors have to be updated manual with updateInstalledConfigData(Data*)
data_.updateInstalledConfigData();
return MHWD::STATUS::SUCCESS;
}
}
......@@ -614,7 +619,7 @@ bool Mhwd::runScript(std::shared_ptr<Config> config, MHWD::TRANSACTIONTYPE opera
for (auto&& foundDevice = foundDevices.begin();
foundDevice != foundDevices.end(); ++foundDevice)
{
bool found = false;
static bool found = false;
// Check if already in list
for (auto&& dev = devices.begin(); dev != devices.end(); ++dev)
......
......@@ -83,8 +83,6 @@ private:
std::shared_ptr<Config> getDatabaseConfig(const std::string& configName, const std::string& configType);
std::shared_ptr<Config> getAvailableConfig(const std::string& configName, const std::string& configType);
std::vector<Config*> getAllLocalRequirements(Config *config);
MHWD::STATUS performTransaction(const Transaction& transaction);
bool proceedWithInstallation(const std::string& input) const;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment