[Release] wrt-installer_0.1.114
[framework/web/wrt-installer.git] / src / jobs / widget_install / task_file_manipulation.cpp
index c3c7123..c7b0ec6 100644 (file)
@@ -118,7 +118,7 @@ void changeOwnerForDirectory(std::string storagePath, mode_t mode) {
                      "Chown to invaild user");
         }
     } else if (euidaccess(storagePath.c_str(), W_OK | R_OK | X_OK) == 0) {
-        LogInfo(storagePath << " already exists.");
+        LogDebug(storagePath << " already exists.");
         // Even if private directory already is created, private dircetory
         // should change owner.
         if (chown(storagePath.c_str(),
@@ -146,6 +146,7 @@ TaskFileManipulation::TaskFileManipulation(InstallerContext& context) :
     m_context(context),
     m_extHandle(NULL)
 {
+    AddStep(&TaskFileManipulation::StartStep);
     if (INSTALL_LOCATION_TYPE_EXTERNAL !=
             m_context.locationType)
     {
@@ -167,6 +168,7 @@ TaskFileManipulation::TaskFileManipulation(InstallerContext& context) :
 
         AddAbortStep(&TaskFileManipulation::StepAbortCreateExternalDir);
     }
+    AddStep(&TaskFileManipulation::EndStep);
 }
 
 void TaskFileManipulation::StepCreateDirs()
@@ -205,17 +207,17 @@ void TaskFileManipulation::StepCreatePrivateStorageDir()
     LogDebug("Create private storage directory : " <<
             m_context.locations->getPrivateStorageDir());
 
+    changeOwnerForDirectory(storagePath, PRIVATE_STORAGE_MODE);
+
     if (m_context.isUpdateMode) { //update
         std::string backData = m_context.locations->getBackupPrivateDir();
         LogDebug("copy private storage " << backData << " to " << storagePath);
-        WrtUtilMakeDir(storagePath);
         if (!DirectoryApi::DirectoryCopy(backData, storagePath)) {
             LogError("Failed to rename " << backData << " to " << storagePath);
             ThrowMsg(Exceptions::BackupFailed,
                     "Error occurs copy private strage files");
         }
     }
-    changeOwnerForDirectory(storagePath, PRIVATE_STORAGE_MODE);
 
     std::string tempStoragePath = m_context.locations->getPrivateTempStorageDir();
     LogDebug("Create temp private storage directory : " << tempStoragePath);
@@ -435,5 +437,15 @@ void TaskFileManipulation::StepCreateSharedFolder()
                 SHARED_STORAGE_MODE);
     }
 }
+
+void TaskFileManipulation::StartStep()
+{
+    LogDebug("--------- <TaskFileManipulation> : START ----------");
+}
+
+void TaskFileManipulation::EndStep()
+{
+    LogDebug("--------- <TaskFileManipulation> : END ----------");
+}
 } //namespace WidgetInstall
 } //namespace Jobs