Fixed restore /shared/res directory during update hybrid web app.
authorSoyoung Kim <sy037.kim@samsung.com>
Fri, 16 Aug 2013 04:36:16 +0000 (13:36 +0900)
committerGerrit Code Review <gerrit@gerrit.vlan144.tizendev.org>
Fri, 16 Aug 2013 05:00:39 +0000 (05:00 +0000)
[Issue#] P130809-02632
[Problem] icon doesn't update after update hybrid web app.
[Cause] icon files is in shred/res directory at hybrid web app.
But shared/res directory was restored to original directory during update.
So new icon file is missing.
[Solution] shared/res directory should not restore during update logic.
[SCMRequest] N/A

Change-Id: Iad574356177b4ef6ed9d6dd7c06cdd34332c7b89

src/jobs/widget_install/task_file_manipulation.cpp
src/misc/widget_location.cpp
src/misc/widget_location.h

index c7b0ec6..7b1da06 100644 (file)
@@ -420,17 +420,39 @@ void TaskFileManipulation::StepCreateSharedFolder()
             m_context.locations->getSharedRootDir());
 
     WrtUtilMakeDir(sharedPath);
+    WrtUtilMakeDir(m_context.locations->getSharedResourceDir());
 
     if (m_context.isUpdateMode) { //update
-        std::string backData = m_context.locations->getBackupSharedDir();
-        LogDebug("copy shared storage " << backData << " to " << sharedPath);
-        if (!DirectoryApi::DirectoryCopy(backData, sharedPath)) {
-            LogError("Failed to rename " << backData << " to " << sharedPath);
+        std::string backSharedData = m_context.locations->getBackupSharedDir();
+        std::string BackSharedTrusted = m_context.locations->getBackupSharedDir();
+
+
+        /* Restore /shared/data */
+        LogDebug("copy " << m_context.locations->getBackupSharedDataDir() <<
+                " to " << m_context.locations->getSharedDataDir());
+        if (!DirectoryApi::DirectoryCopy(
+                    m_context.locations->getBackupSharedDataDir(),
+                    m_context.locations->getSharedDataDir())) {
+                LogError("Failed to rename " <<
+                        m_context.locations->getBackupSharedDataDir() <<
+                        " to " << m_context.locations->getSharedDataDir());
+                ThrowMsg(Exceptions::BackupFailed,
+                        "Error occurs copy shared strage files");
+            }
+
+        /* Restore /shared/trusted */
+        LogDebug("copy " << m_context.locations->getBackupSharedTrustedDir() <<
+                " to " << m_context.locations->getSharedTrustedDir());
+        if (!DirectoryApi::DirectoryCopy(
+                    m_context.locations->getBackupSharedTrustedDir(),
+                    m_context.locations->getSharedTrustedDir())) {
+            LogError("Failed to rename " <<
+                    m_context.locations->getBackupSharedTrustedDir() << " to " <<
+                    m_context.locations->getSharedTrustedDir());
             ThrowMsg(Exceptions::BackupFailed,
                     "Error occurs copy shared strage files");
         }
     } else {
-        WrtUtilMakeDir(m_context.locations->getSharedResourceDir());
         changeOwnerForDirectory(m_context.locations->getSharedDataDir(),
                 SHARED_STORAGE_MODE);
         changeOwnerForDirectory(m_context.locations->getSharedTrustedDir(),
index 40b2129..32d0a16 100644 (file)
@@ -276,3 +276,13 @@ std::string WidgetLocation::getBackupSharedDir() const
 {
     return getBackupDir() + "/shared";
 }
+
+std::string WidgetLocation::getBackupSharedDataDir() const
+{
+    return getBackupSharedDir() + "/data";
+}
+
+std::string WidgetLocation::getBackupSharedTrustedDir() const
+{
+    return getBackupSharedDir() + "/trusted";
+}
index c3f8c39..a3b3e74 100644 (file)
@@ -135,6 +135,8 @@ class WidgetLocation
     std::string getSharedDataDir() const; // /opt/usr/apps/[package]/shared/data
     std::string getSharedTrustedDir() const; // /opt/usr/apps/[package]/shared/trusted
     std::string getBackupSharedDir() const; // /opt/usr/apps/[package].backup/shared
+    std::string getBackupSharedDataDir() const; // /opt/usr/apps/[package].backup/shared/data
+    std::string getBackupSharedTrustedDir() const; // /opt/usr/apps/[package].backup/shared/trusted
 
     // Temporary paths
     /**