#ifndef COMMON_CONTEXT_INSTALLER_H_
#define COMMON_CONTEXT_INSTALLER_H_
+#include <boost/filesystem/path.hpp>
+
#include <pkgmgr_parser.h>
#include <unistd.h>
Property<manifest_x*> manifest_data;
// path to manifest xml file used to register data in databases
- Property<std::string> xml_path;
+ Property<boost::filesystem::path> xml_path;
// pkgid used for update or uninstallation processing
Property<std::string> pkgid;
// package directory path containing app data
- Property<std::string> pkg_path;
+ Property<boost::filesystem::path> pkg_path;
// file path used for installation or reinstallation process
- Property<std::string> file_path;
+ Property<boost::filesystem::path> file_path;
// directory path where app data are temporarily extracted
- Property<std::string> unpacked_dir_path;
+ Property<boost::filesystem::path> unpacked_dir_path;
// uid of the user that request the operation
Property<uid_t> uid;
Property<ConfigData> config_data;
// path for the applications directory
- Property<std::string> application_path;
+ Property<boost::filesystem::path> application_path;
// path for the applications root directory
- Property<std::string> root_application_path;
+ Property<boost::filesystem::path> root_application_path;
};
} // namespace common_installer
namespace signature {
Step::Status StepCheckSignature::process() {
- return (SignatureValidator::Check(bf::path(context_->unpacked_dir_path.get()))
+ return (SignatureValidator::Check(context_->unpacked_dir_path.get())
== SignatureValidator::INVALID) ? Status::ERROR : Status::OK;
}
xmlTextWriterWriteAttribute(writer, BAD_CAST "appid", BAD_CAST app->appid);
// binary is a symbolic link named <appid> and is located in <pkgid>/<appid>
- fs::path exec_path = fs::path(context_->pkg_path.get()) / fs::path(app->appid)
+ fs::path exec_path = context_->pkg_path.get() / fs::path(app->appid)
/ fs::path("bin") / fs::path(app->appid);
xmlTextWriterWriteAttribute(writer, BAD_CAST "exec",
BAD_CAST exec_path.string().c_str());
: Step(context),
is_extracted_(false) {}
-boost::filesystem::path StepUnzip::GenerateTmpDir(const std::string &app_path) {
+boost::filesystem::path StepUnzip::GenerateTmpDir(const bf::path &app_path) {
boost::filesystem::path install_tmp_dir;
boost::filesystem::path tmp_dir(app_path);
return Step::Status::ERROR;
}
- int64_t required_size =
- GetUnpackedPackageSize(bf::path(context_->file_path.get()));
+ int64_t required_size = GetUnpackedPackageSize(context_->file_path.get());
if (required_size == -1) {
LOG(ERROR) << "Couldn't get uncompressed size for package: "
return Step::Status::OUT_OF_SPACE;
}
- if (ExtractToTmpDir(context_->file_path.get().c_str(), tmp_dir)
+ if (ExtractToTmpDir(context_->file_path.get().string().c_str(), tmp_dir)
!= Step::Status::OK) {
LOG(ERROR) << "Failed to process unpack step";
return Step::Status::ERROR;
}
- context_->unpacked_dir_path.set(tmp_dir.string());
+ context_->unpacked_dir_path.set(tmp_dir);
LOG(INFO) << context_->file_path.get() << " was successfully unzipped into "
<< context_->unpacked_dir_path.get();
}
Step::Status StepUnzip::undo() {
- if (access(context_->unpacked_dir_path.get().c_str(), F_OK) == 0) {
+ if (access(context_->unpacked_dir_path.get().string().c_str(), F_OK) == 0) {
bf::remove_all(context_->unpacked_dir_path.get());
LOG(DEBUG) << "remove temp dir: " << context_->unpacked_dir_path.get();
}
#include <boost/filesystem/path.hpp>
-#include <string>
-
#include "common/context_installer.h"
#include "common/step/step.h"
#include "utils/logging.h"
Status undo() override;
private:
- boost::filesystem::path GenerateTmpDir(const std::string &app_path);
+ boost::filesystem::path GenerateTmpDir(
+ const boost::filesystem::path& app_path);
Step::Status ExtractToTmpDir(const char* source_dir,
const boost::filesystem::path& tmp_dir);
boost::system::error_code error;
for (; app != nullptr; app=app->next) {
- fs::path bindir = fs::path(context->pkg_path.get()) / fs::path(app->appid) /
+ fs::path bindir = context->pkg_path.get() / fs::path(app->appid) /
fs::path("bin");
LOG(INFO) << "Creating dir: " << bindir;
if (!common_installer::utils::CreateDir(bindir)) {
for (; ui != nullptr; ui = ui->next) {
// binary is a symbolic link named <appid> and is located in <pkgid>/<appid>
fs::path exec_path =
- fs::path(context_->pkg_path.get()) / fs::path(ui->appid)
+ context_->pkg_path.get() / fs::path(ui->appid)
/ fs::path("bin");
common_installer::utils::CreateDir(exec_path);
for (; svc != nullptr; svc = svc->next) {
// binary is a symbolic link named <appid> and is located in <pkgid>/<appid>
fs::path exec_path =
- fs::path(context_->pkg_path.get()) / fs::path(svc->appid)/
+ context_->pkg_path.get() / fs::path(svc->appid)/
fs::path("bin");
common_installer::utils::CreateDir(exec_path);
for (; ui != nullptr; ui = ui->next) {
fs::path exec_path =
- fs::path(context_->pkg_path.get()) / fs::path(ui->appid)
+ context_->pkg_path.get() / fs::path(ui->appid)
/ fs::path("bin");
if (fs::exists(exec_path))
fs::remove_all(exec_path);
}
for (; svc != nullptr; svc = svc->next) {
fs::path exec_path =
- fs::path(context_->pkg_path.get()) / fs::path(svc->appid)
+ context_->pkg_path.get() / fs::path(svc->appid)
/ fs::path("bin");
if (fs::exists(exec_path))
fs::remove_all(exec_path);