#include <widget_uninstall/job_widget_uninstall.h>
#include <widget_uninstall/widget_uninstall_errors.h>
#include <dpl/wrt-dao-ro/widget_dao_read_only.h>
+#include <dpl/utils/wrt_utility.h>
+#include <dpl/utils/path.h>
#include <ace_api_install.h>
#include <dpl/assert.h>
#include <ace-common/ace_api_common.h>
m_context(context)
{
AddStep(&TaskDbUpdate::StartStep);
+ AddStep(&TaskDbUpdate::StepRemoveExternalLocations);
AddStep(&TaskDbUpdate::StepDbUpdate);
AddStep(&TaskDbUpdate::StepLiveboxDBDelete);
AddStep(&TaskDbUpdate::EndStep);
}
}
+void TaskDbUpdate::StepRemoveExternalLocations()
+{
+ if (!m_context.removeAbnormal) {
+ WidgetDAO dao(DPL::FromUTF8String(m_context.tzAppid));
+ LogDebug("Removing external locations:");
+ WrtDB::ExternalLocationList externalPaths = dao.getWidgetExternalLocations();
+ FOREACH(file, externalPaths)
+ {
+ DPL::Utils::Path path(*file);
+ if(path.Exists()){
+ if(path.IsFile()){
+ LogDebug(" -> " << path.Fullpath());
+ Try{
+ DPL::Utils::Remove(path);
+ }Catch(DPL::Utils::Path::BaseException){
+ LogError("Failed to remove the file: " << path.Fullpath());
+ }
+ } else if (path.IsDir()){
+ LogDebug(" -> " << path.Fullpath());
+ Try{
+ DPL::Utils::Remove(path);
+ }Catch(DPL::Utils::Path::BaseException){
+ Throw(Jobs::WidgetUninstall::TaskDbUpdate::
+ Exception::RemoveFilesFailed);
+ }
+ }
+ }else{
+ LogWarning(" -> " << path.Fullpath() << "(no such a path)");
+ }
+ }
+ dao.unregisterAllExternalLocations();
+ }
+}
+
void TaskDbUpdate::StartStep()
{
LogDebug("--------- <TaskDbUpdate> : START ----------");
public:
DECLARE_EXCEPTION_TYPE(DPL::Exception, Base)
DECLARE_EXCEPTION_TYPE(Base, DbStepFailed)
+ DECLARE_EXCEPTION_TYPE(Base, RemoveFilesFailed)
};
UninstallerContext& m_context;
private:
void StepDbUpdate();
void StepLiveboxDBDelete();
+ void StepRemoveExternalLocations();
void StartStep();
void EndStep();
{
AddStep(&TaskRemoveFiles::StartStep);
AddStep(&TaskRemoveFiles::StepRemoveInstallationDirectory);
- AddStep(&TaskRemoveFiles::StepRemoveExternalLocations);
AddStep(&TaskRemoveFiles::StepRemoveFinished);
AddStep(&TaskRemoveFiles::EndStep);
}
"Widget remove steps Finished");
}
-void TaskRemoveFiles::StepRemoveExternalLocations()
-{
- if (!m_context.removeAbnormal) {
- WidgetDAO dao(DPL::FromUTF8String(m_context.tzAppid));
- LogDebug("Removing external locations:");
- WrtDB::ExternalLocationList externalPaths = dao.getWidgetExternalLocations();
- FOREACH(file, externalPaths)
- {
- DPL::Utils::Path path(*file);
- if(path.Exists()){
- if(path.IsFile()){
- LogDebug(" -> " << path.Fullpath());
- Try{
- DPL::Utils::Remove(path);
- }Catch(DPL::Utils::Path::BaseException){
- LogError("Failed to remove the file: " << path.Fullpath());
- }
- } else if (path.IsDir()){
- LogDebug(" -> " << path.Fullpath());
- Try{
- DPL::Utils::Remove(path);
- }Catch(DPL::Utils::Path::BaseException){
- Throw(Jobs::WidgetUninstall::TaskRemoveFiles::
- Exception::RemoveFilesFailed);
- }
- }
- }else{
- LogWarning(" -> " << path.Fullpath() << "(no such a path)");
- }
- }
- dao.unregisterAllExternalLocations();
- }
-}
-
void TaskRemoveFiles::StartStep()
{
LogDebug("--------- <TaskRemoveFiles> : START ----------");
private:
void StepRemoveInstallationDirectory();
void StepRemoveFinished();
- void StepRemoveExternalLocations();
void StartStep();
void EndStep();