${INSTALLER_JOBS}/plugin_install/plugin_metafile_reader.cpp
${INSTALLER_JOBS}/widget_install/job_widget_install.cpp
${INSTALLER_JOBS}/widget_install/manifest.cpp
+ ${INSTALLER_JOBS}/widget_install/task_commons.cpp
${INSTALLER_JOBS}/widget_install/task_process_config.cpp
${INSTALLER_JOBS}/widget_install/task_database.cpp
${INSTALLER_JOBS}/widget_install/task_configuration.cpp
${INSTALLER_JOBS}/widget_install/task_pkg_info_update.cpp
${INSTALLER_JOBS}/widget_install/widget_security.cpp
${INSTALLER_JOBS}/widget_install/widget_update_info.cpp
+ ${INSTALLER_JOBS}/widget_install/directory_api.cpp
${INSTALLER_JOBS}/widget_install/widget_unzip.cpp
${INSTALLER_JOBS}/widget_uninstall/job_widget_uninstall.cpp
${INSTALLER_JOBS}/widget_uninstall/task_check.cpp
pcrecpp::RE re(REGEXP_ID);
if (!re.FullMatch(DPL::ToUTF8String(*m_id), &package))
{
- _D("package: %s | m_package: %s | m_id: %s",
- package.c_str(), DPL::ToUTF8String(*m_package).c_str(), DPL::ToUTF8String(*m_id).c_str());
ThrowMsg(Exception::ParseError,
"invalid format of id attribute");
}
--- /dev/null
+/*
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file directory_api.cpp
+ * @author Soyoung Kim(sy037.kim@samsung.com)
+ * @version 1.0
+ * @brief directory api - implementation file
+ */
+
+#include <cerrno>
+#include <directory_api.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <dirent.h>
+#include <fstream>
+#include <dpl/foreach.h>
+#include <dpl/utils/wrt_utility.h>
+#include <dpl/errno_string.h>
+#include <installer_log.h>
+
+namespace DirectoryApi {
+bool DirectoryCopy(std::string source, std::string dest)
+{
+ DIR* dir = opendir(source.c_str());
+ if (NULL == dir) {
+ return false;
+ }
+
+ struct dirent dEntry;
+ struct dirent *dEntryResult;
+ int return_code;
+
+ do {
+ struct stat statInfo;
+ return_code = readdir_r(dir, &dEntry, &dEntryResult);
+ if (dEntryResult != NULL && return_code == 0) {
+ std::string fileName = dEntry.d_name;
+ std::string fullName = source + "/" + fileName;
+
+ if (stat(fullName.c_str(), &statInfo) != 0) {
+ closedir(dir);
+ return false;
+ }
+
+ if (S_ISDIR(statInfo.st_mode)) {
+ if (("." == fileName) || (".." == fileName)) {
+ continue;
+ }
+ std::string destFolder = dest + "/" + fileName;
+ WrtUtilMakeDir(destFolder);
+
+ if (!DirectoryCopy(fullName, destFolder)) {
+ closedir(dir);
+ return false;
+ }
+ }
+
+ std::string destFile = dest + "/" + fileName;
+ std::ifstream infile(fullName);
+ std::ofstream outfile(destFile);
+ outfile << infile.rdbuf();
+ outfile.close();
+ infile.close();
+
+ errno = 0;
+ if (-1 == TEMP_FAILURE_RETRY(chown(destFile.c_str(),
+ statInfo.st_uid,
+ statInfo.st_gid))) {
+ int error = errno;
+ _E("Failed to change owner [%s]", DPL::GetErrnoString(error).c_str());
+ }
+ }
+ } while (dEntryResult != NULL && return_code == 0);
+ closedir(dir);
+ return true;
+}
+}
--- /dev/null
+/*
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file directory_api.h
+ * @author Soyoung Kim(sy037.kim@samsung.com)
+ * @version 1.0
+ * @brief directory api - header file
+ */
+#ifndef WRT_SRC_INSTALLER_CORE_DIRECTORY_API_H_
+#define WRT_SRC_INSTALLER_CORE_DIRECTORY_API_H_
+
+#include<string>
+
+namespace DirectoryApi {
+bool DirectoryCopy(std::string source, std::string dest);
+}
+
+#endif /* WRT_SRC_INSTALLER_CORE_DIRECTORY_API_H_ */
+
#include <widget_install/task_remove_backup.h>
#include <widget_install/task_encrypt_resource.h>
#include <widget_install/task_pkg_info_update.h>
+#include <widget_install/task_commons.h>
#include <widget_install/task_prepare_reinstall.h>
#include <widget_install/task_configuration.h>
--- /dev/null
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/*
+ * @file task_commons.cpp
+ * @author Krzysztof Jackiewicz (k.jackiewicz@samsung.com)
+ * @version 1.0
+ */
+
+#include "task_commons.h"
+#include <unistd.h>
+#include <sstream>
+#include <ftw.h>
+#include <sys/stat.h>
+#include <sys/time.h>
+#include <dpl/wrt-dao-ro/global_config.h>
+#include <dpl/exception.h>
+#include <dpl/errno_string.h>
+#include <dpl/utils/wrt_utility.h>
+#include <widget_install/widget_install_errors.h>
+#include <installer_log.h>
+
+namespace Jobs {
+namespace WidgetInstall {
+namespace {
+const char * const TEMPORARY_PATH_POSTFIX = "temp";
+const mode_t TEMPORARY_PATH_MODE = 0775;
+} // namespace
+
+std::string createTempPath(bool preload)
+{
+ _D("Step: Creating temporary path");
+
+ // Temporary path
+ std::ostringstream tempPathBuilder;
+
+ if (preload) {
+ tempPathBuilder << WrtDB::GlobalConfig::GetUserPreloadedWidgetPath();
+ } else {
+ tempPathBuilder << WrtDB::GlobalConfig::GetUserInstalledWidgetPath();
+ }
+ tempPathBuilder << WrtDB::GlobalConfig::GetTmpDirPath();
+ tempPathBuilder << "/";
+ tempPathBuilder << TEMPORARY_PATH_POSTFIX;
+ tempPathBuilder << "_";
+
+ timeval tv;
+ gettimeofday(&tv, NULL);
+ tempPathBuilder <<
+ (static_cast<unsigned long long>(tv.tv_sec) * 1000000ULL +
+ static_cast<unsigned long long>(tv.tv_usec));
+
+ std::string tempPath = tempPathBuilder.str();
+
+ // Remove old path if any
+ struct stat fileInfo;
+
+ if (stat(tempPath.c_str(), &fileInfo) == 0) {
+ if (!WrtUtilRemove(tempPath)) {
+ ThrowMsg(Exceptions::RemovingFolderFailure,
+ "Failed to to remove temporary directory");
+ }
+ }
+ // Create new path
+ if (!WrtUtilMakeDir(tempPath, TEMPORARY_PATH_MODE)) {
+ ThrowMsg(Exceptions::FileOperationFailed,
+ "Failed to create temporary directory");
+ }
+
+ return tempPath;
+}
+
+void createTempPath(const std::string& path)
+{
+ if (!WrtUtilMakeDir(path, TEMPORARY_PATH_MODE)) {
+ ThrowMsg(Exceptions::FileOperationFailed,
+ "Failed to create temporary directory");
+ }
+}
+} // WidgetInstall
+} // Jobs
--- /dev/null
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/*
+ * @file task_commons.h
+ * @author Krzysztof Jackiewicz (k.jackiewicz@samsung.com)
+ * @version 1.0
+ */
+
+#ifndef INSTALLER_CORE_JOS_WIDGET_INSTALL_TASK_COMMONS_H_
+#define INSTALLER_CORE_JOS_WIDGET_INSTALL_TASK_COMMONS_H_
+
+#include <string>
+
+namespace Jobs {
+namespace WidgetInstall {
+//TODO make directory like jobs common?
+
+std::string createTempPath(bool isReadOnly = false);
+void createTempPath(const std::string& path);
+} // WidgetInstall
+} // Jobs
+
+#endif /* INSTALLER_CORE_JOS_WIDGET_INSTALL_TASK_COMMONS_H_ */
#include <widget_install_to_external.h>
#include <widget_install/widget_unzip.h>
#include <widget_install/job_widget_install.h>
+#include <widget_install/task_commons.h>
#include <installer_log.h>
static const DPL::String SETTING_VALUE_ENCRYPTION = L"encryption";
static const DPL::String SETTING_VALUE_ENCRYPTION_ENABLE = L"enable";
static const DPL::String SETTING_VALUE_ENCRYPTION_DISABLE = L"disable";
-
const DPL::String SETTING_VALUE_INSTALLTOEXT_NAME = L"install-location";
const DPL::String SETTING_VALUE_INSTALLTOEXT_PREPER_EXT = L"prefer-external";
const DPL::String SETTING_VALUE_INSTALLTOEXT_AUTO = L"auto";
-const std::string XML_EXTENSION = "xml";
+const std::string XML_EXTENSION = ".xml";
+
+bool hasExtension(const std::string& filename, const std::string& extension)
+{
+ _D("Looking for extension %s in %s", extension.c_str(), filename.c_str());
+ size_t fileLen = filename.length();
+ size_t extLen = extension.length();
+ if (fileLen < extLen) {
+ _E("Filename %s is shorter than extension %s", filename.c_str(), extension.c_str());
+ return false;
+ }
+ return (0 == filename.compare(fileLen - extLen, extLen, extension));
+}
} // namespace anonymous
namespace Jobs {
void TaskConfiguration::SetupTempDirStep()
{
_D("widgetPath: %s", m_context.requestedPath.c_str());
- if (m_context.mode.extension == InstallMode::ExtensionType::DIR)
- {
- if(m_context.mode.command == InstallMode::Command::REINSTALL)
- {
+ _D("tempPath: %s", m_tempDir.c_str());
+ if (m_context.mode.extension == InstallMode::ExtensionType::DIR) {
+ if (m_context.mode.command ==
+ InstallMode::Command::REINSTALL) {
std::ostringstream tempPathBuilder;
tempPathBuilder << WrtDB::GlobalConfig::GetUserInstalledWidgetPath();
tempPathBuilder << WrtDB::GlobalConfig::GetTmpDirPath();
tempPathBuilder << "/";
tempPathBuilder << m_context.requestedPath;
m_tempDir = tempPathBuilder.str();
- }
- else
+ } else {
m_tempDir = m_context.requestedPath;
- }
- else
- {
+ }
+ } else {
m_tempDir =
- DPL::Utils::CreateTempPath(
- DPL::Utils::Path(
- m_context.mode.rootPath == InstallMode::RootPath::RO ?
- WrtDB::GlobalConfig::GetUserPreloadedWidgetPath()
- :
- WrtDB::GlobalConfig::GetUserInstalledWidgetPath()
- )
- ).Fullpath();
-
- if(!DPL::Utils::Path(m_context.requestedPath).hasExtension(XML_EXTENSION))
+ Jobs::WidgetInstall::createTempPath(
+ m_context.mode.rootPath ==
+ InstallMode::RootPath::RO);
+ if(!hasExtension(m_context.requestedPath, XML_EXTENSION)) //unzip everything except xml files
{
WidgetUnzip wgtUnzip;
wgtUnzip.unzipWgtFile(m_context.requestedPath, m_tempDir);
_D("From browser installation - unzip is not done");
}
}
-
- _D("tempPath: %s", m_tempDir.c_str());
}
void TaskConfiguration::ParseXMLConfigStep()
void TaskConfiguration::CheckPackageTypeStep()
{
- if (DPL::Utils::Path(m_context.requestedPath).hasExtension(XML_EXTENSION)){
+ if (hasExtension(m_context.requestedPath, XML_EXTENSION)) {
_D("Hosted app installation");
m_context.widgetConfig.packagingType = PKG_TYPE_HOSTED_WEB_APP;
return;
#include <unistd.h>
#include <sys/stat.h>
#include <dirent.h>
-
#include <widget_install/task_file_manipulation.h>
#include <widget_install/job_widget_install.h>
#include <widget_install/widget_install_errors.h>
#include <widget_install/widget_install_context.h>
-#include <widget_install_to_external.h>
-
+#include <widget_install/directory_api.h>
#include <dpl/utils/wrt_utility.h>
#include <dpl/foreach.h>
#include <dpl/assert.h>
#include <dpl/errno_string.h>
#include <dpl/utils/folder_size.h>
-#include <dpl/utils/path.h>
#include <dpl/wrt-dao-ro/global_config.h>
-
#include <string>
#include <fstream>
#include <widget_install_to_external.h>
namespace {
const char* GLIST_RES_DIR = "res";
+bool _FolderCopy(std::string source, std::string dest)
+{
+ DIR* dir = opendir(source.c_str());
+ if (NULL == dir) {
+ return false;
+ }
+
+ struct dirent dEntry;
+ struct dirent *dEntryResult;
+ int return_code;
+
+ do {
+ struct stat statInfo;
+ return_code = readdir_r(dir, &dEntry, &dEntryResult);
+ if (dEntryResult != NULL && return_code == 0) {
+ std::string fileName = dEntry.d_name;
+ std::string fullName = source + "/" + fileName;
+
+ if (stat(fullName.c_str(), &statInfo) != 0) {
+ closedir(dir);
+ return false;
+ }
+
+ if (S_ISDIR(statInfo.st_mode)) {
+ if (("." == fileName) || (".." == fileName)) {
+ continue;
+ }
+ std::string destFolder = dest + "/" + fileName;
+ WrtUtilMakeDir(destFolder);
+
+ if (!_FolderCopy(fullName, destFolder)) {
+ closedir(dir);
+ return false;
+ }
+ }
+
+ std::string destFile = dest + "/" + fileName;
+ std::ifstream infile(fullName);
+ std::ofstream outfile(destFile);
+ outfile << infile.rdbuf();
+ outfile.close();
+ infile.close();
+ }
+ } while (dEntryResult != NULL && return_code == 0);
+ closedir(dir);
+ return true;
+}
+
void changeOwnerForDirectory(std::string storagePath, mode_t mode) {
if (euidaccess(storagePath.c_str(), F_OK) != 0) {
if (!WrtUtilMakeDir(storagePath, mode)) {
void TaskFileManipulation::StepCreatePrivateStorageDir()
{
std::string storagePath = m_context.locations->getPrivateStorageDir();
- _D("Create private storage directory : %s", storagePath.c_str());
+ _D("Create private storage directory : %s", m_context.locations->getPrivateStorageDir().c_str());
changeOwnerForDirectory(storagePath, PRIVATE_STORAGE_MODE);
if (m_context.isUpdateMode) { //update
- DPL::Utils::Path backData = DPL::Utils::Path(m_context.locations->getBackupPrivateDir());
- DPL::Utils::Path storageData = DPL::Utils::Path(storagePath);
- _D("copy private storage %s to %s", backData.Fullpath().c_str(), storageData.Fullpath().c_str());
-
- Try
- {
- DPL::Utils::CopyDir(backData, storageData);
- }
- Catch(DPL::Utils::Path::BaseException)
- {
- ThrowMsg(Exceptions::BackupFailed, "Error occurs copy private storage files");
+ std::string backData = m_context.locations->getBackupPrivateDir();
+ _D("copy private storage %s to %s", backData.c_str(), storagePath.c_str());
+ if (!DirectoryApi::DirectoryCopy(backData, storagePath)) {
+ _E("Failed to rename %s to %s", backData.c_str(), storagePath.c_str());
+ ThrowMsg(Exceptions::BackupFailed,
+ "Error occurs copy private strage files");
}
}
void TaskFileManipulation::StepInstallToExternal()
{
- std::string sourceDir = m_context.locations->getSourceDir();
_D("StepInstallExternal");
- if (!WrtUtilMakeDir(sourceDir)) {
+ if (!WrtUtilMakeDir(m_context.locations->getSourceDir())) {
ThrowMsg(Exceptions::ErrorExternalInstallingFailure,
"To make src \
directory failed");
}
- _D("Resource move to external storage %s", sourceDir.c_str());
-
- DPL::Utils::Path from = DPL::Utils::Path(m_context.locations->getTemporaryPackageDir());
- DPL::Utils::Path to = DPL::Utils::Path(sourceDir);
- _D("Copy shared storage %s to %s", from.Fullpath().c_str(), to.Fullpath().c_str());
-
- Try
+ _D("Resource move to external storage %s", m_context.locations->getSourceDir().c_str());
+ if (!_FolderCopy(m_context.locations->getTemporaryPackageDir(),
+ m_context.locations->getSourceDir()))
{
- DPL::Utils::CopyDir(from, to);
- }
- Catch(DPL::Utils::Path::BaseException)
- {
- ThrowMsg(Exceptions::ErrorExternalInstallingFailure, "Error occurs during renaming widget folder");
+ ThrowMsg(Exceptions::ErrorExternalInstallingFailure,
+ "Error occurs during renaming widget folder");
}
}
{
_D("StepCreateSharedFolder");
std::string sharedPath = m_context.locations->getSharedRootDir();
- _D("Create shared directory : %s", sharedPath.c_str());
+ _D("Create shared directory : %s", m_context.locations->getSharedRootDir().c_str());
WrtUtilMakeDir(sharedPath);
WrtUtilMakeDir(m_context.locations->getSharedResourceDir());
changeOwnerForDirectory(m_context.locations->getSharedTrustedDir(),
SHARED_STORAGE_MODE);
+
// additional check for rootPath installation
// If this app is preloaded, "shared" diretory is already on place and do not needs to be moved
// TODO: why "shared" is on RW partion always but "data" and "tmp" are linked
if (m_context.isUpdateMode
&& !(m_context.mode.rootPath == InstallMode::RootPath::RO
&& m_context.mode.installTime == InstallMode::InstallTime::PRELOAD)) {
- DPL::Utils::Path backData = DPL::Utils::Path(m_context.locations->getBackupSharedDataDir());
- DPL::Utils::Path sharedData = DPL::Utils::Path(m_context.locations->getSharedDataDir());
- DPL::Utils::Path backTrusted = DPL::Utils::Path(m_context.locations->getBackupSharedTrustedDir());
- DPL::Utils::Path sharedTrusted = DPL::Utils::Path(m_context.locations->getSharedTrustedDir());
/* Restore /shared/data */
- _D("Copy %s to %s", backData.Fullpath().c_str(), sharedData.Fullpath().c_str());
- Try
- {
- DPL::Utils::CopyDir(backData, sharedData);
- }
- Catch(DPL::Utils::Path::BaseException)
- {
- ThrowMsg(Exceptions::BackupFailed, "Error occurs copy shared storage files");
- }
+ _D("copy %s to %s", m_context.locations->getBackupSharedDataDir().c_str(), m_context.locations->getSharedDataDir().c_str());
+ if (!DirectoryApi::DirectoryCopy(
+ m_context.locations->getBackupSharedDataDir(),
+ m_context.locations->getSharedDataDir())) {
+ _E("Failed to rename %s to %s", m_context.locations->getBackupSharedDataDir().c_str(), m_context.locations->getSharedDataDir().c_str());
+ ThrowMsg(Exceptions::BackupFailed,
+ "Error occurs copy shared strage files");
+ }
/* Restore /shared/trusted */
- _D("Copy %s to %s", backTrusted.Fullpath().c_str(), sharedTrusted.Fullpath().c_str());
- Try
- {
- DPL::Utils::CopyDir(backTrusted, sharedTrusted);
- }
- Catch(DPL::Utils::Path::BaseException)
- {
- ThrowMsg(Exceptions::BackupFailed, "Error occurs copy shared storage files");
+ _D("copy %s to %s", m_context.locations->getBackupSharedTrustedDir().c_str(), m_context.locations->getSharedTrustedDir().c_str());
+ if (!DirectoryApi::DirectoryCopy(
+ m_context.locations->getBackupSharedTrustedDir(),
+ m_context.locations->getSharedTrustedDir())) {
+ _E("Failed to rename %s to %s", m_context.locations->getBackupSharedTrustedDir().c_str(), m_context.locations->getSharedTrustedDir().c_str());
+ ThrowMsg(Exceptions::BackupFailed,
+ "Error occurs copy shared strage files");
}
}
}
#include <dpl/foreach.h>
#include <widget_install/widget_install_context.h>
#include <widget_install_errors.h>
+#include <task_commons.h>
#include <installer_log.h>
namespace Jobs {
#include <dpl/foreach.h>
#include <dpl/assert.h>
#include <dpl/utils/wrt_utility.h>
-#include <dpl/utils/path.h>
#include <dpl/wrt-dao-rw/widget_dao.h>
#include <widget_install/job_widget_install.h>
#include <widget_install/widget_install_errors.h>
if (WrtUtilRemove(tmp)) {
_D("Success to remove temp directory : %s", tmp.c_str());
} else {
- if (!DPL::Utils::Exists(DPL::Utils::Path(tmp)))
- _E("Temp directory doesn't exist : %s", tmp.c_str());
- else
- _D("Temp directory exists : %s", tmp.c_str());
-
_E("Failed to remove temp directory : %s", tmp.c_str());
}
}
#include <widget_install/widget_install_context.h>
#include <widget_install/widget_install_errors.h>
#include <widget_install/job_widget_install.h>
+#include <widget_install/directory_api.h>
#include <dpl/wrt-dao-ro/global_config.h>
#include <dpl/exception.h>
#include <widget_install/job_widget_install.h>
#include <dpl/copy.h>
#include <dpl/file_output.h>
-#include "dpl/utils/path.h"
#include <dpl/abstract_waitable_input_adapter.h>
#include <dpl/wrt-dao-ro/global_config.h>
+#include <task_commons.h>
#include <sys/stat.h>
#include <dlfcn.h>
#include <installer_log.h>
_D("Path to extract: %s", newPath.c_str());
// Create path in case of it is empty
- Try
- {
- DPL::Utils::MakeDir(DPL::Utils::Path(newPath));
- }
- Catch(DPL::Utils::Path::BaseException)
- {
- ThrowMsg(Exceptions::FileOperationFailed, "Failed to create temporary directory");
- }
+ createTempPath(newPath);
} else {
// This is regular file
std::string fileExtractPath = destination + "/" + fileName;
_D("Path and file: %s : %s", pathAndFile.path.c_str(), pathAndFile.file.c_str());
// First, ensure that path exists
- Try
- {
- DPL::Utils::MakeDir(DPL::Utils::Path(pathAndFile.path));
- }
- Catch(DPL::Utils::Path::BaseException)
- {
- ThrowMsg(Exceptions::FileOperationFailed, "Failed to create temporary directory");
- }
+ createTempPath(pathAndFile.path);
Try
{
#include "widget_location.h"
#include <unistd.h>
-#include <dpl/utils/path.h>
#include <dpl/utils/wrt_utility.h>
#include <dpl/wrt-dao-ro/global_config.h>
#include <dpl/assert.h>
#include <dpl/sstream.h>
#include <dpl/localization/localization_utils.h>
+#include <widget_install/task_commons.h>
#include <installer_log.h>
WidgetLocation::DirectoryDeletor::DirectoryDeletor(bool isReadOnly) :
- m_dirpath(DPL::Utils::CreateTempPath(
- DPL::Utils::Path(
- isReadOnly ?
- WrtDB::GlobalConfig::GetUserPreloadedWidgetPath()
- :
- WrtDB::GlobalConfig::GetUserInstalledWidgetPath()
- )
- ).Fullpath())
+ m_dirpath(Jobs::WidgetInstall::createTempPath(isReadOnly))
{}
WidgetLocation::DirectoryDeletor::DirectoryDeletor(std::string tempPath) :
- m_dirpath(tempPath)
+ m_dirpath(tempPath)
{}
WidgetLocation::DirectoryDeletor::~DirectoryDeletor()