[Release] wrt-installer_0.1.55
[framework/web/wrt-installer.git] / src / jobs / widget_uninstall / task_remove_files.cpp
old mode 100644 (file)
new mode 100755 (executable)
index 47ae2ff..709b4a5
@@ -69,10 +69,9 @@ void TaskRemoveFiles::StepRemoveInstallationDirectory()
         {
             LogDebug("Removing directory");
             m_context.removeStarted = true;
-            std::string widgetDir =
-                m_context.locations->getPackageInstallationDir();
-            if (!WrtUtilRemove(widgetDir)) {
-                LogError("Removing widget installation directory failed");
+            if (!WrtUtilRemove(m_context.installedPath)) {
+                LogError("Removing widget installation directory failed : " <<
+                        m_context.installedPath);
             }
             std::string dataDir = m_context.locations->getUserDataRootDir();
             if (!WrtUtilRemove(dataDir)) {
@@ -114,7 +113,14 @@ void TaskRemoveFiles::StepRemoveManifest()
     std::ostringstream manifest_name;
     manifest_name << m_context.tzPkgid << ".xml";
     std::ostringstream destFile;
-    destFile << "/opt/share/packages" << "/"; //TODO constant with path
+    const std::string PRELOAD_INSTALLED_PATH = "/usr/apps";
+    if (0 == (m_context.installedPath).compare(0, PRELOAD_INSTALLED_PATH.length(),
+                PRELOAD_INSTALLED_PATH)) {
+        LogDebug("This widget is prealoded.");
+        destFile << "/usr/share/packages" << "/"; //TODO constant with path
+    } else {
+        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);