[Install Location: Part 3] Implement about install location (auto, internal only...
authorSoyoung Kim <sy037.kim@samsung.com>
Fri, 25 Oct 2013 06:09:58 +0000 (15:09 +0900)
committerSoyoung Kim <sy037.kim@samsung.com>
Thu, 31 Oct 2013 10:52:30 +0000 (19:52 +0900)
[Issue#]   P130919-00555
[Problem]  web app install to internal storage even if install location is set
           "SD card" from setting menu.
[Cause]    There is an issue to process getting install location.
           (Before parsing config.xml, installer cannot get install location info.)
[Solution] - Parsing config.xml should be done before unzip wgt.
           - So parsing config.xml is separated before unzip.
[Remarks] Installer, therefore, should implement below install location spec.
    * Auto: Get setting value about default storage at setting menu.
      - If user set "Device memory" try internal storage.
        If fails, try external storage.
      - If user set "SD card" try SD card.
        If fails, try internal storage.
    * Internal-only: Try internal storage.
      - If there is no space in internal memory, installation is failed.
    * Prefer-external: Try external storage.
      - If SD card is not available, try internal storage.

    There are three parts for implementation.
     * Part 1: This patch is for separating parse config.xml before unzipping wgt file.
     * Part 2: WGT file unzip to directory package directory
               (/opt/usr/apps/[pkgid]) instead of temporary directory.
     * Part 3: Implement about install location (auto, internal only prefer-external)

[Verification]
    SD card should be attached in the device for this feature.
    -  First> Normal and Hybrid web app can be installed without error.
    - Second> WebApp should be installed into device memory or SD card depending
              on install-location

    1. Install-location: internal-only
          => should be installed into device memory
    2. Install-location: prefer-external
          1) SD card is enabled => into SD card.
          2) SD card is disabled => into device memory.
    3. Install-location:
       * Auto and default storage is "Device Memory"
          1) into device memory.
          2) If device Memory is full = > into SD card.
       * Auto and default storage is "SD card"
          1) into SD card
          2) If SD card isn't available => into device memory.
[SCMRequest] N/A

Change-Id: I77a08bcae3709ff68a540ae50ea235df7230d81d

src/commons/wrt_common_types.h
src/jobs/widget_install/job_widget_install.cpp
src/jobs/widget_install/task_configuration.cpp
src/jobs/widget_install/task_file_manipulation.cpp
src/jobs/widget_install/task_file_manipulation.h
src/jobs/widget_install/widget_install_context.h
src/jobs/widget_install/widget_unzip.cpp
src/jobs/widget_install/widget_unzip.h

index 965db9c..d9ea0f0 100644 (file)
@@ -41,8 +41,9 @@ typedef WrtDB::DbPluginHandle PluginHandle;
 enum InstallLocationType
 {
     INSTALL_LOCATION_TYPE_UNKNOWN = 0,
-    INSTALL_LOCATION_TYPE_NOMAL,
-    INSTALL_LOCATION_TYPE_EXTERNAL
+    INSTALL_LOCATION_TYPE_INTERNAL_ONLY,
+    INSTALL_LOCATION_TYPE_AUTO,
+    INSTALL_LOCATION_TYPE_PREFER_EXTERNAL,
 };
 
 #endif /* PLUGIN_COMMON_TYPES_H */
index 27d47c6..58e2068 100644 (file)
@@ -210,7 +210,7 @@ void JobWidgetInstall::SendFinishedSuccess()
     // TODO : sync should move to separate task.
     sync();
 
-    if (INSTALL_LOCATION_TYPE_EXTERNAL == m_installerContext.locationType) {
+    if (INSTALL_LOCATION_TYPE_PREFER_EXTERNAL == m_installerContext.locationType) {
         if (m_installerContext.isUpdateMode) {
             WidgetInstallToExtSingleton::Instance().postUpgrade(true);
         } else {
index 415898f..c336848 100644 (file)
@@ -126,6 +126,8 @@ void TaskConfiguration::StartStep()
 
 void TaskConfiguration::EndStep()
 {
+    m_context.job->UpdateProgress(InstallerContext::INSTALL_PARSE_CONFIG,
+            "Parse config.xml and set structure");
     _D("--------- <TaskConfiguration> : END ----------");
 }
 
@@ -180,9 +182,8 @@ void TaskConfiguration::UnzipConfigurationStep()
     if (m_context.mode.extension != InstallMode::ExtensionType::DIR) {
         if(!hasExtension(m_context.requestedPath, XML_EXTENSION)) //unzip everything except xml files
         {
-            WidgetUnzip wgtUnzip;
-            wgtUnzip.unzipConfiguration(m_context.requestedPath, m_tempDir,
-                    &m_context.widgetConfig.packagingType);
+            WidgetUnzip wgtUnzip(m_context.requestedPath);
+            wgtUnzip.unzipConfiguration(m_tempDir, &m_context.widgetConfig.packagingType);
             m_configuration += m_tempDir + "/" + CONFIG_XML;
         } else{
             m_context.widgetConfig.packagingType = PKG_TYPE_HOSTED_WEB_APP;
@@ -605,55 +606,23 @@ void TaskConfiguration::ResourceEncryptionStep()
     }
 }
 
-bool TaskConfiguration::getMMCStatus()
-{
-    int mmcStatus;
-    if (vconf_get_int(VCONFKEY_SYSMAN_MMC_STATUS, &mmcStatus)) {
-        _E("vconf_get_int(VCONFKEY_SYSMAN_MMC_STATUS) failed.");
-        return false;
-    }
-
-    switch(mmcStatus)
-    {
-    case VCONFKEY_SYSMAN_MMC_MOUNTED:
-        _D("mmcStatus is MMC_MOUNTED.");
-        return true;
-    case VCONFKEY_SYSMAN_MMC_REMOVED:
-    case VCONFKEY_SYSMAN_MMC_INSERTED_NOT_MOUNTED:
-        _D("mmcStatus is MMC_REMOVED or NOT_MOUNTED.");
-        return false;
-    default:
-        _E("Platform is not supported, use the default settings");
-        return false;
-    }
-}
-
-bool TaskConfiguration::getDefaultExternalStorage()
-{
-    // XXX NOT IMPLEMENTED.
-    return false;
-}
-
 void TaskConfiguration::InstallationFSLocationStep()
 {
-    m_context.locationType = INSTALL_LOCATION_TYPE_NOMAL;
-    DPL::String locationValue;
-
     if (m_context.mode.installTime != InstallMode::InstallTime::PRELOAD) {
         FOREACH(it, m_widgetConfig.settingsList) {
             if (it->m_name == SETTING_VALUE_INSTALLTOEXT_NAME) {
-                locationValue = it->m_value;
+                if (it->m_value == SETTING_VALUE_INSTALLTOEXT_AUTO) {
+                    m_context.locationType = INSTALL_LOCATION_TYPE_AUTO;
+                } else if (it->m_value == SETTING_VALUE_INSTALLTOEXT_PREPER_EXT) {
+                    m_context.locationType =
+                        INSTALL_LOCATION_TYPE_PREFER_EXTERNAL;
+                } else {
+                    m_context.locationType =
+                        INSTALL_LOCATION_TYPE_INTERNAL_ONLY;
+                }
                 break;
             }
         }
-
-        if ((SETTING_VALUE_INSTALLTOEXT_PREPER_EXT == locationValue
-                    && getMMCStatus()) ||
-                (SETTING_VALUE_INSTALLTOEXT_AUTO == locationValue
-                 && getDefaultExternalStorage())) {
-            _D("This webapp will be installed to sd card");
-            m_context.locationType = INSTALL_LOCATION_TYPE_EXTERNAL;
-        }
     }
 }
 
index 0ab5ee3..21c089b 100644 (file)
 #include <unistd.h>
 #include <sys/stat.h>
 #include <dirent.h>
+#include <string>
+#include <fstream>
+#include <vconf.h>
+
 #include <widget_install/task_file_manipulation.h>
 #include <widget_install/job_widget_install.h>
 #include <widget_install/widget_install_errors.h>
@@ -33,8 +37,7 @@
 #include <dpl/errno_string.h>
 #include <dpl/utils/folder_size.h>
 #include <dpl/wrt-dao-ro/global_config.h>
-#include <string>
-#include <fstream>
+
 #include <widget_install_to_external.h>
 #include <installer_log.h>
 #include <widget_unzip.h>
@@ -109,40 +112,80 @@ TaskFileManipulation::TaskFileManipulation(InstallerContext& context) :
     m_extHandle(NULL)
 {
     AddStep(&TaskFileManipulation::StartStep);
-    if (INSTALL_LOCATION_TYPE_EXTERNAL !=
-            m_context.locationType)
+    AddStep(&TaskFileManipulation::StepCheckInstallLocation);
+    AddStep(&TaskFileManipulation::StepPrepareRootDirectory);
+    if (m_context.mode.extension != InstallMode::ExtensionType::DIR)
     {
-        AddStep(&TaskFileManipulation::StepCreateDirs);
-        if (m_context.mode.extension != InstallMode::ExtensionType::DIR)
-        {
-            AddStep(&TaskFileManipulation::StepUnzipWgtFile);
-            AddAbortStep(&TaskFileManipulation::StepAbortRenamePath);
-        }
-    } else {
-        AddStep(&TaskFileManipulation::StepPrepareExternalDir);
-        AddStep(&TaskFileManipulation::StepInstallToExternal);
-
-        AddAbortStep(&TaskFileManipulation::StepAbortCreateExternalDir);
+        AddStep(&TaskFileManipulation::StepUnzipWgtFile);
     }
     AddStep(&TaskFileManipulation::EndStep);
+
+    AddAbortStep(&TaskFileManipulation::StepAbortPrepareRootDirectory);
 }
 
-void TaskFileManipulation::StepCreateDirs()
+void TaskFileManipulation::StepCheckInstallLocation()
 {
-    std::string widgetPath;
+    _D("StepCheckInstallLocation");
+    if (m_context.mode.rootPath == InstallMode::RootPath::RO) {
+        m_context.locationType = INSTALL_LOCATION_TYPE_INTERNAL_ONLY;
+        return;
+    }
 
-    widgetPath = m_context.locations->getPackageInstallationDir();
+    std::string installedPath = WrtDB::GlobalConfig::GetUserInstalledWidgetPath();
+    WidgetUnzip wgtUnzip(m_context.requestedPath);
+
+    if (m_context.locationType == INSTALL_LOCATION_TYPE_AUTO) {
+        int storage = 0;
+        // vconf_get_int(VCONFKEY_SETAPPL_DEFAULT_MEM_INSTALL_APPLICATIONS_INT)
+        // 0 : phone internal memory
+        // 1 : SD card
+        if (vconf_get_int(VCONFKEY_SETAPPL_DEFAULT_MEM_INSTALL_APPLICATIONS_INT,
+                    &storage)) {
+            _E("vconf_get_int(VCONFKEY_SETAPPL_DEFAULT_MEM_INSTALL_APPLICATIONS_INT) \
+                    failed.");
+        }
+        _D("default setting : storage [%d]", storage);
+        if (storage) {
+            m_context.locationType = INSTALL_LOCATION_TYPE_PREFER_EXTERNAL;
+        } else {
+            m_context.locationType = INSTALL_LOCATION_TYPE_INTERNAL_ONLY;
+            if(!wgtUnzip.checkAvailableSpace(installedPath)) {
+                m_context.locationType = INSTALL_LOCATION_TYPE_PREFER_EXTERNAL;
+            }
+        }
+    }
 
-    std::string widgetBinPath = m_context.locations->getBinaryDir();
-    std::string widgetSrcPath = m_context.locations->getSourceDir();
+    if (m_context.locationType == INSTALL_LOCATION_TYPE_PREFER_EXTERNAL) {
+        int mmcStatus;
+        if (vconf_get_int(VCONFKEY_SYSMAN_MMC_STATUS, &mmcStatus)) {
+            _E("vconf_get_int(VCONFKEY_SYSMAN_MMC_STATUS) failed.");
+            mmcStatus = VCONFKEY_SYSMAN_MMC_INSERTED_NOT_MOUNTED;
+        }
+
+        if (VCONFKEY_SYSMAN_MMC_MOUNTED != mmcStatus) {
+            _D("mmcStatus is MMC_REMOVED or NOT_MOUNTED.");
+            m_context.locationType = INSTALL_LOCATION_TYPE_INTERNAL_ONLY;
+        }
+    }
 
-    WrtUtilMakeDir(widgetPath);
+    if (m_context.locationType == INSTALL_LOCATION_TYPE_INTERNAL_ONLY) {
+        if(!wgtUnzip.checkAvailableSpace(installedPath)) {
+            ThrowMsg(Exceptions::OutOfStorageFailed, "There is no space for installation");
+        }
+    }
+}
 
-    // If package type is widget with osp service, we don't need to make bin
-    // and src directory
-    if (m_context.widgetConfig.packagingType == PKG_TYPE_HYBRID_WEB_APP) {
-        _D("Doesn't need to create resource directory");
+void TaskFileManipulation::StepPrepareRootDirectory()
+{
+    if (m_context.locationType == INSTALL_LOCATION_TYPE_PREFER_EXTERNAL) {
+        prepareExternalDir();
     } else {
+        std::string widgetPath = m_context.locations->getPackageInstallationDir();
+        std::string widgetBinPath = m_context.locations->getBinaryDir();
+        std::string widgetSrcPath = m_context.locations->getSourceDir();
+
+        WrtUtilMakeDir(widgetPath);
+
         _D("Create resource directory");
         WrtUtilMakeDir(widgetBinPath);
         WrtUtilMakeDir(widgetSrcPath);
@@ -169,38 +212,44 @@ void TaskFileManipulation::StepUnzipWgtFile()
 
         _D("unzip file to %s", instDir.c_str());
 
-        WidgetUnzip wgtUnzip;
-        wgtUnzip.unzipWgtFile(m_context.requestedPath, instDir);
+        WidgetUnzip wgtUnzip(m_context.requestedPath);
+        wgtUnzip.unzipWgtFile(instDir);
     } else {
         _D("From browser installation - unzip is not done");
     }
 
     m_context.job->UpdateProgress(
         InstallerContext::INSTALL_UNZIP_WGT,
-        "Unzip WGT File");
+        "Unzip Wgt file");
 }
 
-/* TODO :  modify name */
-void TaskFileManipulation::StepAbortRenamePath()
+void TaskFileManipulation::StepAbortPrepareRootDirectory()
 {
-    _D("[Rename Widget Path] Aborting.... (Rename path)");
-    std::string widgetPath;
-    widgetPath = m_context.locations->getPackageInstallationDir();
-    if (!WrtUtilRemove(widgetPath)) {
-        _E("Error occurs during removing existing folder");
-    }
-    // Remove user data directory if preload web app.
-    std::string userData = m_context.locations->getUserDataRootDir();
-    if (0 == access(userData.c_str(), F_OK)) {
-        if (!WrtUtilRemove(userData)) {
-            _E("Error occurs during removing user data directory");
+    _D("[Create Root Directory]  Aborting.... (Rename path)");
+    if (m_context.locationType == INSTALL_LOCATION_TYPE_PREFER_EXTERNAL) {
+        if (m_context.isUpdateMode) {
+            WidgetInstallToExtSingleton::Instance().postUpgrade(false);
+        } else {
+            WidgetInstallToExtSingleton::Instance().postInstallation(false);
+        }
+        WidgetInstallToExtSingleton::Instance().deinitialize();
+    } else {
+        std::string widgetPath;
+        widgetPath = m_context.locations->getPackageInstallationDir();
+        if (!WrtUtilRemove(widgetPath)) {
+            _E("Error occurs during removing existing folder");
+        }
+        // Remove user data directory if preload web app.
+        std::string userData = m_context.locations->getUserDataRootDir();
+        if (0 == access(userData.c_str(), F_OK)) {
+            if (!WrtUtilRemove(userData)) {
+                _E("Error occurs during removing user data directory");
+            }
         }
     }
-
-    _D("Rename widget path sucessful!");
 }
 
-void TaskFileManipulation::StepPrepareExternalDir()
+void TaskFileManipulation::prepareExternalDir()
 {
     _D("Step prepare to install in exernal directory");
     Try {
@@ -209,10 +258,10 @@ void TaskFileManipulation::StepPrepareExternalDir()
 
         WidgetInstallToExtSingleton::Instance().initialize(pkgid);
 
-        size_t totalSize =
-            Utils::getFolderSize(m_context.locations->getTemporaryPackageDir());
-
-        int folderSize = (int)(totalSize / (1024 * 1024)) + 1;
+        std::unique_ptr<DPL::ZipInput> zipFile(new
+                DPL::ZipInput(m_context.requestedPath));
+        double unzipSize = zipFile->GetTotalUncompressedSize();
+        int folderSize = (int)(unzipSize / (1024 * 1024)) + 1;
 
         GList *list = NULL;
         app2ext_dir_details* dirDetail = NULL;
@@ -241,42 +290,19 @@ void TaskFileManipulation::StepPrepareExternalDir()
         /* make bin directory */
         std::string widgetBinPath = m_context.locations->getBinaryDir();
         WrtUtilMakeDir(widgetBinPath);
+        std::string sourceDir = m_context.locations->getSourceDir();
+        WrtUtilMakeDir(sourceDir);
     }
-    Catch(WidgetInstallToExt::Exception::ErrorInstallToExt)
-    {
+    Catch(DPL::ZipInput::Exception::OpenFailed) {
         ReThrowMsg(Exceptions::ErrorExternalInstallingFailure,
                    "Error during \
                 create external folder ");
     }
-}
-
-void TaskFileManipulation::StepInstallToExternal()
-{
-    _D("StepInstallExternal");
-    if (!WrtUtilMakeDir(m_context.locations->getSourceDir())) {
-        ThrowMsg(Exceptions::ErrorExternalInstallingFailure,
-                 "To make src \
-                directory failed");
-    }
-
-    _D("Resource move to external storage %s", m_context.locations->getSourceDir().c_str());
-    if (!_FolderCopy(m_context.locations->getTemporaryPackageDir(),
-                     m_context.locations->getSourceDir()))
+    Catch(WidgetInstallToExt::Exception::ErrorInstallToExt)
     {
-        ThrowMsg(Exceptions::ErrorExternalInstallingFailure,
-                 "Error occurs during renaming widget folder");
-    }
-}
-
-void TaskFileManipulation::StepAbortCreateExternalDir()
-{
-    _E("Abort StepAbortCreateExternalDir");
-    if (m_context.isUpdateMode) {
-        WidgetInstallToExtSingleton::Instance().postUpgrade(false);
-    } else {
-        WidgetInstallToExtSingleton::Instance().postInstallation(false);
+        ReThrowMsg(Exceptions::ErrorExternalInstallingFailure,
+                   "Error during create external folder ");
     }
-    WidgetInstallToExtSingleton::Instance().deinitialize();
 }
 
 void TaskFileManipulation::StartStep()
index 80d3218..113ca72 100644 (file)
@@ -36,20 +36,17 @@ class TaskFileManipulation :
     app2ext_handle *m_extHandle;
 
     // install internal location
-    void StepCreateDirs();
+    void StepCheckInstallLocation();
+    void StepPrepareRootDirectory();
     void StepUnzipWgtFile();
-
-    void StepAbortRenamePath();
-
-    // install external location
-    void StepPrepareExternalDir();
-    void StepInstallToExternal();
-    void StepFinishExternalInstallation();
-    void StepAbortCreateExternalDir();
-
+    void StepAbortPrepareRootDirectory();
+    void StepLinkForPreload();
     void StartStep();
     void EndStep();
 
+    // install external location
+    void prepareExternalDir();
+
   public:
     TaskFileManipulation(InstallerContext& context);
 };
index e591bf3..967a737 100644 (file)
@@ -47,6 +47,7 @@ struct InstallerContext
     typedef enum InstallStepEnum
     {
         INSTALL_START = 0,
+        INSTALL_PARSE_CONFIG,
         INSTALL_CHECK_FILE,
 
         INSTALL_RDS_DELTA_CHECK,
index 0bdaedc..057b6c3 100644 (file)
@@ -71,6 +71,23 @@ PathAndFilePair SplitFileAndPath(const std::string &filePath)
 
 namespace Jobs {
 namespace WidgetInstall {
+
+WidgetUnzip::WidgetUnzip(const std::string &source)
+{
+    Try {
+        m_requestFile = getDecryptedPackage(source);
+        m_zip.reset(new DPL::ZipInput(m_requestFile));
+    }
+    Catch(DPL::ZipInput::Exception::OpenFailed)
+    {
+        ReThrowMsg(Exceptions::OpenZipFailed, source);
+    }
+    Catch(Exceptions::DrmDecryptFailed)
+    {
+        ReThrowMsg(Exceptions::ExtractFileFailed, source);
+    }
+}
+
 void WidgetUnzip::ExtractFile(DPL::ZipInput::File *input,
                             const std::string &destFileName)
 {
@@ -258,26 +275,19 @@ std::string WidgetUnzip::getDecryptedPackage(const std::string &source)
     return source;
 }
 
-void WidgetUnzip::unzipWgtFile(const std::string &source, const std::string &destination)
+void WidgetUnzip::unzipWgtFile(const std::string &destination)
 {
     _D("Prepare to unzip...");
-    std::string wgtFile;
     Try
     {
-        wgtFile = getDecryptedPackage(source);
-        _D("wgtFile : %s", wgtFile.c_str());
-
-        m_zip.reset(new DPL::ZipInput(wgtFile));
+        _D("wgtFile : %s", m_requestFile.c_str());
         _D("Widget package comment: %s", m_zip->GetGlobalComment().c_str());
 
-
         // Widget package must not be empty
         if (m_zip->empty()) {
-            ThrowMsg(Exceptions::ZipEmpty, wgtFile);
+            ThrowMsg(Exceptions::ZipEmpty, m_requestFile);
         }
 
-        checkAvailableSpace(destination);
-
         // Set iterator to first file
         m_zipIterator = m_zip->begin();
 
@@ -291,19 +301,19 @@ void WidgetUnzip::unzipWgtFile(const std::string &source, const std::string &des
     }
     Catch(DPL::ZipInput::Exception::OpenFailed)
     {
-        ReThrowMsg(Exceptions::OpenZipFailed, wgtFile);
+        ReThrowMsg(Exceptions::OpenZipFailed, m_requestFile);
     }
     Catch(DPL::ZipInput::Exception::SeekFileFailed)
     {
-        ThrowMsg(Exceptions::ExtractFileFailed, wgtFile);
+        ThrowMsg(Exceptions::ExtractFileFailed, m_requestFile);
     }
     Catch(Exceptions::DrmDecryptFailed)
     {
-        ReThrowMsg(Exceptions::ExtractFileFailed, wgtFile);
+        ReThrowMsg(Exceptions::ExtractFileFailed, m_requestFile);
     }
 }
 
-void WidgetUnzip::checkAvailableSpace(const std::string &destination)
+bool WidgetUnzip::checkAvailableSpace(const std::string &destination)
 {
     _D("checkAvailableSpace ... ");
 
@@ -312,35 +322,35 @@ void WidgetUnzip::checkAvailableSpace(const std::string &destination)
 
     struct statvfs vfs;
     if (-1 == statvfs(destination.c_str(), &vfs)) {
-        ThrowMsg(Exceptions::OutOfStorageFailed, "There is no space for installation");
+        _E("There is no space for installation");
+        return false;
     }
 
     double freeSize = (double)vfs.f_bsize * vfs.f_bavail;
     _D("Space Size : %ld", freeSize);
 
     if (unCompressedSize + SPACE_SIZE >= freeSize) {
-        ThrowMsg(Exceptions::OutOfStorageFailed, "There is no space for installation");
+        _E("There is no space for installation");
+        return false;
     }
+    return true;
 }
 
-void WidgetUnzip::unzipConfiguration(const std::string &source,
-        const std::string &destination, WrtDB::PackagingType* type)
+void WidgetUnzip::unzipConfiguration(const std::string &destination,
+        WrtDB::PackagingType* type)
 {
     _D("unzipConfiguration");
 
     Try {
-        std::string wgtFile = getDecryptedPackage(source);
-        _D("wgtFile : %s", wgtFile.c_str());
-
-        std::unique_ptr<DPL::ZipInput> zipFile(new DPL::ZipInput(source));
+        _D("wgtFile : %s", m_requestFile.c_str());
 
         std::unique_ptr<DPL::ZipInput::File> configFile;
 
         Try {
-            configFile.reset(zipFile->OpenFile(HYBRID_CONFIG_XML));
+            configFile.reset(m_zip->OpenFile(HYBRID_CONFIG_XML));
             *type = PKG_TYPE_HYBRID_WEB_APP;
         } Catch(DPL::ZipInput::Exception::OpenFileFailed) {
-            configFile.reset(zipFile->OpenFile(WEB_APP_CONFIG_XML));
+            configFile.reset(m_zip->OpenFile(WEB_APP_CONFIG_XML));
             *type = PKG_TYPE_NOMAL_WEB_APP;
         }
 
@@ -349,7 +359,7 @@ void WidgetUnzip::unzipConfiguration(const std::string &source,
     }
     Catch(DPL::ZipInput::Exception::OpenFailed)
     {
-        ReThrowMsg(Exceptions::OpenZipFailed, source);
+        ReThrowMsg(Exceptions::OpenZipFailed, m_requestFile);
     }
     Catch(DPL::ZipInput::Exception::OpenFileFailed)
     {
@@ -357,7 +367,7 @@ void WidgetUnzip::unzipConfiguration(const std::string &source,
     }
     Catch(Exceptions::DrmDecryptFailed)
     {
-        ReThrowMsg(Exceptions::ExtractFileFailed, source);
+        ReThrowMsg(Exceptions::ExtractFileFailed, m_requestFile);
     }
 }
 
index df37f00..204cde7 100644 (file)
@@ -32,14 +32,16 @@ namespace WidgetInstall {
 class WidgetUnzip 
 {
   public:
-      void unzipWgtFile(const std::string &source, const std::string &destination);
-      void unzipConfiguration(const std::string &source, const std::string
-              &destination, WrtDB::PackagingType *type);
+      WidgetUnzip(const std::string &source);
+      void unzipWgtFile(const std::string &destination);
+      void unzipConfiguration(const std::string &destination, WrtDB::PackagingType *type);
+      bool checkAvailableSpace(const std::string &destination);
 
   private:
     // Unzip state
     std::unique_ptr<DPL::ZipInput> m_zip;
     DPL::ZipInput::const_iterator m_zipIterator;
+    std::string m_requestFile;
 
     void unzipProgress(const std::string &destination);
     void ExtractFile(DPL::ZipInput::File *input, const std::string
@@ -48,7 +50,6 @@ class WidgetUnzip
     bool decryptDRMPackage(const std::string &source, const std::string
             &decryptedSource);
     std::string getDecryptedPackage(const std::string &source);
-    void checkAvailableSpace(const std::string &destination);
 };
 
 } //namespace WidgetInstall