* @brief Implementation file for uninstaller task for removing widget files
*/
+#include <unistd.h>
#include <widget_uninstall/task_remove_files.h>
#include <widget_uninstall/job_widget_uninstall.h>
#include <widget_uninstall/uninstaller_context.h>
namespace Jobs {
namespace WidgetUninstall {
-
using namespace WrtDB;
namespace {
}
TaskRemoveFiles::~TaskRemoveFiles()
-{
-}
+{}
void TaskRemoveFiles::StepRemoveInstallationDirectory()
{
m_context.removeStarted = true;
std::string widgetDir =
m_context.locations->getPackageInstallationDir();
- if(!WrtUtilRemove(widgetDir)){
+ if (!WrtUtilRemove(widgetDir)) {
LogWarning("Removing widget installation directory failed");
}
std::string dataDir = m_context.locations->getUserDataRootDir();
- if(!WrtUtilRemove(dataDir)){
+ if (!WrtUtilRemove(dataDir)) {
LogWarning(dataDir + " is already removed");
}
m_context.job->UpdateProgress(
const char* package = m_context.tzAppid.c_str();
LogDebug("ail delete : " << package);
- ret = ail_package_get_appinfo(package, &ai);
+ ret = ail_get_appinfo(package, &ai);
if (ai) {
- ail_package_destroy_appinfo(ai);
+ ail_destroy_appinfo(ai);
}
if (AIL_ERROR_OK == ret) {
- if ( 0 > ail_desktop_remove(package)) {
+ if (0 > ail_desktop_remove(package)) {
LogWarning("Failed to remove ail information : " << package);
}
}
void TaskRemoveFiles::StepRemoveManifest()
{
std::ostringstream manifest_name;
- manifest_name << m_context.tzPkgid<< ".xml";
+ manifest_name << m_context.tzPkgid << ".xml";
std::ostringstream destFile;
destFile << "/opt/share/packages" << "/"; //TODO constant with path
destFile << manifest_name.str();
- int ret1 = pkgmgr_parser_parse_manifest_for_uninstallation(destFile.str().c_str(), NULL);
+ int ret1 = pkgmgr_parser_parse_manifest_for_uninstallation(
+ destFile.str().c_str(), NULL);
int ret2 = unlink(destFile.str().c_str());
- if(ret1 != 0)
- {
+ if (ret1 != 0) {
LogWarning("Manifest file failed to parse for uninstallation");
}
- if(ret2 != 0)
- {
+ if (ret2 != 0) {
LogWarning("No manifest file found: " << destFile.str());
- }
- else
- {
+ } else {
LogDebug("Manifest file removed: " << destFile.str());
}
}
WrtDB::ExternalLocationList externalPaths = dao.getWidgetExternalLocations();
FOREACH(path, externalPaths)
{
- if(WrtUtilFileExists(*path))
- {
+ if (WrtUtilFileExists(*path)) {
LogDebug(" -> " << *path);
int ret = remove(path->c_str());
if (ret != 0) {
- LogError("Failed to remove the file: " << path->c_str() << " with error: " << strerror(errno));
+ LogError(
+ "Failed to remove the file: " << path->c_str() <<
+ " with error: " << strerror(errno));
}
- }
- else if(WrtUtilDirExists(*path))
- {
+ } else if (WrtUtilDirExists(*path)) {
LogDebug(" -> " << *path);
- if(!WrtUtilRemove(*path)){
- Throw(Jobs::WidgetUninstall::TaskRemoveFiles::Exception::RemoveFilesFailed);
+ if (!WrtUtilRemove(*path)) {
+ Throw(
+ Jobs::WidgetUninstall::TaskRemoveFiles::Exception::
+ RemoveFilesFailed);
}
- }
- else
- {
+ } else {
LogWarning(" -> " << *path << "(no such a path)");
}
}
void TaskRemoveFiles::StepRemoveVconf()
{
std::string key =
- WrtDB::VconfConfig::GetVconfKeyRootPath(DPL::FromUTF8String(m_context.tzAppid));
- if(vconf_unset_recursive(key.c_str())) {
+ WrtDB::VconfConfig::GetVconfKeyRootPath(DPL::FromUTF8String(m_context.
+ tzAppid));
+ if (vconf_unset_recursive(key.c_str())) {
LogError("Fail to unset vconf file");
} else {
LogDebug("vconf file is removed");
WidgetInstallToExtSingleton::Instance().uninstallation();
WidgetInstallToExtSingleton::Instance().deinitialize();
}
- Catch (WidgetInstallToExt::Exception::ErrorInstallToExt)
+ Catch(WidgetInstallToExt::Exception::ErrorInstallToExt)
{
- Throw(Jobs::WidgetUninstall::TaskRemoveFiles::Exception::RemoveFilesFailed);
+ Throw(
+ Jobs::WidgetUninstall::TaskRemoveFiles::Exception::
+ RemoveFilesFailed);
}
}
-
} //namespace WidgetUninstall
} //namespace Jobs