tizen 2.4 release
[framework/web/wrt-installer.git] / src / jobs / widget_uninstall / task_delete_pkginfo.cpp
 #include <dpl/wrt-dao-ro/widget_dao_read_only.h>
 #include <pkgmgr/pkgmgr_parser.h>
 #include <dpl/assert.h>
-#include <dpl/utils/wrt_utility.h>
-#include <dpl/utils/path.h>
-#include <installer_log.h>
+#include <boost/filesystem.hpp>
+#include <dpl/log/secure_log.h>
+
+namespace bf = boost::filesystem;
 
 namespace Jobs {
 namespace WidgetUninstall {
@@ -45,31 +46,34 @@ TaskDeletePkgInfo::TaskDeletePkgInfo(
 
 void TaskDeletePkgInfo::StartStep()
 {
-    _D("--------- <TaskDeletePkgInfo> : START ----------");
+    LOGI("--------- <TaskDeletePkgInfo> : START ----------");
 }
 
 void TaskDeletePkgInfo::EndStep()
 {
-    _D("--------- <TaskDeletePkgInfo> : END ----------");
+    LOGI("--------- <TaskDeletePkgInfo> : END ----------");
 }
 
 void TaskDeletePkgInfo::StepDeletePkgInfo()
 {
     std::ostringstream manifest_name;
     manifest_name << m_context.tzPkgid << ".xml";
-    DPL::Utils::Path pre_manifest("/usr/share/packages");
+    bf::path pre_manifest("/usr/share/packages");
     pre_manifest /= manifest_name.str();
-
-    if (!(m_context.manifestFile.Exists() == 0 && pre_manifest.Exists())) {
-        if (0 !=  pkgmgr_parser_parse_manifest_for_uninstallation(
-                    m_context.manifestFile.Fullpath().c_str(), NULL)) {
-            _W("Manifest file failed to parse for uninstallation");
+    try {
+        if (!(bf::exists(m_context.manifestFile) == 0 && bf::exists(pre_manifest))) {
+            if (0 !=  pkgmgr_parser_parse_manifest_for_uninstallation(
+                        m_context.manifestFile.c_str(), NULL)) {
+                _W("Manifest file failed to parse for uninstallation");
+            }
         }
-    }
-    if (!DPL::Utils::TryRemove(m_context.manifestFile)) {
-        _W("No manifest file found: %s", m_context.manifestFile.Fullpath().c_str());
-    } else {
-        _D("Manifest file removed: %s", m_context.manifestFile.Fullpath().c_str());
+        if (bf::remove_all(bf::path(m_context.manifestFile))) {
+            _D("Manifest file removed: %s", m_context.manifestFile.c_str());
+        } else {
+            _W("No manifest file found: %s", m_context.manifestFile.c_str());
+        }
+    } catch (const bf::filesystem_error& ex) {
+        _E("boost::filesystem::error: %s", ex.what());
     }
 }
 } //namespace WidgetUninstall