X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fjobs%2Fwidget_uninstall%2Ftask_remove_files.cpp;h=ac26deb243bce8f9c1aced6f865a5e6ad7b0d6d7;hb=f56543848daf0a8585b6023c11cb1738b42b5e1e;hp=2e120fec8120e3d4a0250f13c80ae8d0df506a33;hpb=8751fcd683990373dd3d8275dc01052a658fe34f;p=framework%2Fweb%2Fwrt-installer.git diff --git a/src/jobs/widget_uninstall/task_remove_files.cpp b/src/jobs/widget_uninstall/task_remove_files.cpp index 2e120fe..ac26deb 100644 --- a/src/jobs/widget_uninstall/task_remove_files.cpp +++ b/src/jobs/widget_uninstall/task_remove_files.cpp @@ -20,6 +20,7 @@ * @brief Implementation file for uninstaller task for removing widget files */ +#include #include #include #include @@ -37,7 +38,6 @@ namespace Jobs { namespace WidgetUninstall { - using namespace WrtDB; namespace { @@ -61,8 +61,7 @@ TaskRemoveFiles::TaskRemoveFiles(UninstallerContext& context) : } TaskRemoveFiles::~TaskRemoveFiles() -{ -} +{} void TaskRemoveFiles::StepRemoveInstallationDirectory() { @@ -71,11 +70,11 @@ 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( @@ -107,13 +106,13 @@ void TaskRemoveFiles::StepRemoveDesktop() 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); } } @@ -126,22 +125,19 @@ void TaskRemoveFiles::StepRemoveDesktop() 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()); } } @@ -153,23 +149,22 @@ void TaskRemoveFiles::StepRemoveExternalLocations() 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)"); } } @@ -179,8 +174,9 @@ void TaskRemoveFiles::StepRemoveExternalLocations() 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"); @@ -194,11 +190,12 @@ void TaskRemoveFiles::StepRemoveExternalWidget() 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