X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fjobs%2Fwidget_uninstall%2Ftask_db_update.cpp;fp=src_wearable%2Fjobs%2Fwidget_uninstall%2Ftask_db_update.cpp;h=347b391f6619c5b4a7e32d319e971415e7612fa0;hb=8dca06a97c6e118a413c9a5e3890750baa75b799;hp=0c391fd13dfdde283c2303144cac0abf6ae74a2e;hpb=764ea635f2e980157258d6c3107a4480a6ae12d0;p=framework%2Fweb%2Fwrt-installer.git diff --git a/src_wearable/jobs/widget_uninstall/task_db_update.cpp b/src/jobs/widget_uninstall/task_db_update.cpp similarity index 64% rename from src_wearable/jobs/widget_uninstall/task_db_update.cpp rename to src/jobs/widget_uninstall/task_db_update.cpp index 0c391fd..347b391 100755 --- a/src_wearable/jobs/widget_uninstall/task_db_update.cpp +++ b/src/jobs/widget_uninstall/task_db_update.cpp @@ -20,22 +20,21 @@ * @brief Implementation file for uninstaller task database updating */ -#ifdef DBOX_ENABLED -#include -#endif +#include #include #include #include +#if USE(WEB_PROVIDER) +#include +#endif #include -#include -#include -#include #include -#include #include -#include +#include +#include using namespace WrtDB; +namespace bf = boost::filesystem; namespace Jobs { namespace WidgetUninstall { @@ -46,7 +45,7 @@ TaskDbUpdate::TaskDbUpdate(UninstallerContext& context) : AddStep(&TaskDbUpdate::StartStep); AddStep(&TaskDbUpdate::StepRemoveExternalLocations); AddStep(&TaskDbUpdate::StepDbUpdate); -#ifdef DBOX_ENABLED +#if USE(WEB_PROVIDER) AddStep(&TaskDbUpdate::StepLiveboxDBDelete); #endif AddStep(&TaskDbUpdate::EndStep); @@ -61,7 +60,6 @@ void TaskDbUpdate::StepDbUpdate() { //TODO: widget handle should not be used any more FOREACH(it , m_context.tzAppIdList){ - ace_unregister_widget(static_cast(WidgetDAOReadOnly::getHandle(*it))); WidgetDAO::unregisterWidget(*it); } _D("Unregistered widget successfully!"); @@ -74,16 +72,16 @@ void TaskDbUpdate::StepDbUpdate() } } -#ifdef DBOX_ENABLED +#if USE(WEB_PROVIDER) void TaskDbUpdate::StepLiveboxDBDelete() { FOREACH(it, m_context.tzAppIdList){ int ret = - web_provider_livebox_delete_by_app_id(DPL::ToUTF8String(*it).c_str()); + web_provider_widget_delete_by_app_id(DPL::ToUTF8String(*it).c_str()); - if (ret < 0) { - _D("failed to delete box info"); - } else { + if (ret < 0) { + _D("failed to delete box info"); + } else { _D("delete box info: %s", it); } } @@ -99,26 +97,16 @@ void TaskDbUpdate::StepRemoveExternalLocations() WrtDB::ExternalLocationList externalPaths = dao.getWidgetExternalLocations(); FOREACH(file, externalPaths) { - DPL::Utils::Path path(*file); - if(path.Exists()){ - if(path.IsFile()){ - _D(" -> %s", path.Fullpath().c_str()); - Try { - DPL::Utils::Remove(path); - } Catch(DPL::Utils::Path::BaseException){ - _E("Failed to remove the file: %s", path.Fullpath().c_str()); - } - } else if (path.IsDir()){ - _D(" -> %s", path.Fullpath().c_str()); - Try { - DPL::Utils::Remove(path); - } Catch(DPL::Utils::Path::BaseException){ - Throw(Jobs::WidgetUninstall::TaskDbUpdate:: - Exception::RemoveFilesFailed); - } + bf::path path(*file); + try { + if(bf::exists(path)){ + JobWidgetUninstall::SecureRemove(path); + } else { + _W(" -> %s(no such a path)", path.c_str()); } - } else { - _W(" -> %s(no such a path)", path.Fullpath().c_str()); + } catch (const bf::filesystem_error& ex) { + _E("Failed to remove the file: %s", path.c_str()); + Throw(Jobs::WidgetUninstall::TaskDbUpdate::Exception::RemoveFilesFailed); } } dao.unregisterAllExternalLocations(); @@ -128,7 +116,7 @@ void TaskDbUpdate::StepRemoveExternalLocations() void TaskDbUpdate::StartStep() { - LOGD("--------- : START ----------"); + LOGI("--------- : START ----------"); } void TaskDbUpdate::EndStep() @@ -137,7 +125,7 @@ void TaskDbUpdate::EndStep() UninstallerContext::UNINSTALL_DB_UPDATE, "Widget DB Update Finished"); - LOGD("--------- : END ----------"); + LOGI("--------- : END ----------"); } } //namespace WidgetUninstall } //namespace Jobs