} else {
AddStep(&TaskRemoveFiles::StepRemoveExternalWidget);
}
- //AddStep(&TaskRemoveFiles::StepRemoveDesktop);
AddStep(&TaskRemoveFiles::StepRemoveManifest);
AddStep(&TaskRemoveFiles::StepRemoveExternalLocations);
AddStep(&TaskRemoveFiles::StepRemoveVconf);
"Widget remove steps Finished");
}
-void TaskRemoveFiles::StepRemoveDesktop()
-{
- std::ostringstream desktopFile;
-
- desktopFile << GlobalConfig::GetUserWidgetDesktopPath() << "/";
- desktopFile << m_context.tzAppid << ".desktop";
-
- unlink(desktopFile.str().c_str());
-
- ail_appinfo_h ai = NULL;
- ail_error_e ret;
-
- const char* package = m_context.tzAppid.c_str();
- LogDebug("ail delete : " << package);
-
- ret = ail_get_appinfo(package, &ai);
- if (ai) {
- ail_destroy_appinfo(ai);
- }
-
- if (AIL_ERROR_OK == ret) {
- if (0 > ail_desktop_remove(package)) {
- LogWarning("Failed to remove ail information : " << package);
- }
- }
-
- m_context.job->UpdateProgress(
- UninstallerContext::UNINSTALL_REMOVE_DESKTOP,
- "Widget remove desktop Finished");
-}
-
void TaskRemoveFiles::StepRemoveManifest()
{
std::ostringstream manifest_name;
void TaskRemoveFiles::StepRemoveExternalLocations()
{
- WidgetDAO dao(DPL::FromUTF8String(m_context.tzAppid));
- LogDebug("Removing external locations:");
- WrtDB::ExternalLocationList externalPaths = dao.getWidgetExternalLocations();
- FOREACH(path, externalPaths)
- {
- 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));
+ if (!m_context.removeAbnormal) {
+ WidgetDAO dao(DPL::FromUTF8String(m_context.tzAppid));
+ LogDebug("Removing external locations:");
+ WrtDB::ExternalLocationList externalPaths = dao.getWidgetExternalLocations();
+ FOREACH(path, externalPaths)
+ {
+ 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));
+ }
+ } else if (WrtUtilDirExists(*path)) {
+ LogDebug(" -> " << *path);
+ if (!WrtUtilRemove(*path)) {
+ Throw(
+ Jobs::WidgetUninstall::TaskRemoveFiles::Exception::
+ RemoveFilesFailed);
+ }
+ } else {
+ LogWarning(" -> " << *path << "(no such a path)");
}
- } else if (WrtUtilDirExists(*path)) {
- LogDebug(" -> " << *path);
- if (!WrtUtilRemove(*path)) {
- Throw(
- Jobs::WidgetUninstall::TaskRemoveFiles::Exception::
- RemoveFilesFailed);
- }
- } else {
- LogWarning(" -> " << *path << "(no such a path)");
}
+ dao.unregisterAllExternalLocations();
}
- dao.unregisterAllExternalLocations();
}
void TaskRemoveFiles::StepRemoveVconf()
{
- std::string key =
- 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");
+ if (!m_context.removeAbnormal) {
+ std::string key =
+ 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");
+ }
}
}