Change temporary storage path
authorJihoon Chung <jihoon.chung@samsung.com>
Wed, 29 May 2013 06:50:36 +0000 (15:50 +0900)
committerJihoon Chung <jihoon.chung@samsung.com>
Thu, 30 May 2013 06:02:04 +0000 (15:02 +0900)
[Issue#] H0100184102
[Problem] Using tizen.download to download to "wgt-private" works,
but not to "wgt-private-tmp"
[Cause] N/A
[Solution]
Change temporary storage path app directory
Before : /tmp/pkgid/
After  : /opt/usr/apps/pkgid/tmp/
[SCMRequest] must be imported with wrt-commons

Change-Id: Ie23da9d17e4c0c4c459b5df9e33af0cebade2f7c

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

index b365d9a..fbbae03 100644 (file)
@@ -217,6 +217,10 @@ void TaskFileManipulation::StepCreatePrivateStorageDir()
         }
     }
     changeOwnerForDirectory(storagePath);
+
+    std::string tempStoragePath = m_context.locations->getPrivateTempStorageDir();
+    LogDebug("Create temp private storage directory : " << tempStoragePath);
+    changeOwnerForDirectory(tempStoragePath);
 }
 
 void TaskFileManipulation::StepRenamePath()
index e927a7f..31ab408 100644 (file)
@@ -116,11 +116,21 @@ void TaskSmack::StepSmackFolderLabeling()
     }
 
     /* data directory */
-    if (PC_OPERATION_SUCCESS != app_label_dir(m_pkgId,
-                m_context.locations->getPrivateStorageDir().c_str())) {
+    if (PC_OPERATION_SUCCESS !=
+        app_label_dir(m_pkgId,
+                      m_context.locations->getPrivateStorageDir().c_str()))
+    {
         LogWarning("Add label to " << m_context.locations->getPrivateStorageDir());
     }
 
+    /* tmp directory */
+    if (PC_OPERATION_SUCCESS !=
+        app_label_dir(m_pkgId,
+                      m_context.locations->getPrivateTempStorageDir().c_str()))
+    {
+        LogWarning("Add label to " << m_context.locations->getPrivateTempStorageDir());
+    }
+
     /* bin directory */
     if (PC_OPERATION_SUCCESS != app_label_dir(m_pkgId,
                 m_context.locations->getBinaryDir().c_str())) {
index a2905aa..4c93057 100644 (file)
@@ -173,6 +173,13 @@ std::string WidgetLocation::getPrivateStorageDir() const
            WrtDB::GlobalConfig::GetWidgetPrivateStoragePath();
 }
 
+std::string WidgetLocation::getPrivateTempStorageDir() const
+{
+    return getUserDataRootDir() + "/" +
+           WrtDB::GlobalConfig::GetWidgetPrivateTempStoragePath();
+}
+
+
 std::string WidgetLocation::getTemporaryPackageDir() const
 {
     return m_temp->getTempPath();
index ad73d80..2b44d4d 100644 (file)
@@ -124,6 +124,7 @@ class WidgetLocation
     std::string getBackupPrivateDir() const;  // /opt/apps/[pkg].backup/data
     std::string getUserDataRootDir() const; // /opt/usr/apps/[package]
     std::string getPrivateStorageDir() const; // /opt/usr/apps/[package]/data
+    std::string getPrivateTempStorageDir() const; // /opt/usr/apps/[package]/tmp
     std::string getSharedRootDir() const; // /opt/usr/apps/[package]/shared
     std::string getSharedResourceDir() const; // /opt/usr/apps/[package]/shared/res
     std::string getSharedDataDir() const; // /opt/usr/apps/[package]/shared/data