- Apply early-return policy.
- Print error while some boost API calling has failed.
Change-Id: I659e486fe6e7ed540497613470fa3c3a19d774e1
Signed-off-by: Junghyun Yeon <jungh.yeon@samsung.com>
common_installer::Step::Status StepCheckReinstallManifest::process() {
bf::path target = context_->unpacked_dir_path.get() / kManifest;
- if (!bf::exists(target)) {
- bf::path source = context_->root_application_path.get() /
- context_->pkgid.get() / kManifest;
- if (!bf::exists(source)) {
- LOG(ERROR) << "Cannot find old manifest file";
- return Status::APP_DIR_ERROR;
- }
- bs::error_code error;
- bf::copy_file(source, target, error);
- if (error) {
- LOG(ERROR) << "Failed to copy old manifest file";
- return Status::APP_DIR_ERROR;
- }
+ if (bf::exists(target))
+ return Status::OK;
+
+ bf::path source = context_->root_application_path.get() /
+ context_->pkgid.get() / kManifest;
+ if (!bf::exists(source)) {
+ LOG(ERROR) << "Cannot find old manifest file";
+ return Status::APP_DIR_ERROR;
}
+ bs::error_code error;
+ bf::copy_file(source, target, error);
+ if (error) {
+ LOG(ERROR) << "Failed to copy old manifest file";
+ return Status::APP_DIR_ERROR;
+ }
+
return Status::OK;
}
namespace bs = boost::system;
common_installer::Step::Status StepCheckPkgDirPath::process() {
- if (!bf::exists(context_->GetPkgPath())) {
- LOG(INFO) << "Create pkg_path("
- << context_->GetPkgPath()
- << ") for package("
- << context_->pkgid.get() << ")";
- bs::error_code error;
- bf::create_directories(context_->GetPkgPath(), error);
- if (error) {
- LOG(ERROR) << "Cannot create directory: "
- << context_->GetPkgPath().string();
- return Step::Status::APP_DIR_ERROR;
- }
+ if (bf::exists(context_->GetPkgPath()))
+ return Status::OK;
+
+ LOG(INFO) << "Create pkg_path("
+ << context_->GetPkgPath()
+ << ") for package("
+ << context_->pkgid.get() << ")";
+ bs::error_code error;
+ bf::create_directories(context_->GetPkgPath(), error);
+ if (error) {
+ LOG(ERROR) << "Cannot create directory: "
+ << context_->GetPkgPath().string();
+ << ", error: " << error.what();
+ return Step::Status::APP_DIR_ERROR;
}
return Status::OK;
typedef common_installer::Step::Status Status;
bool CreateSymLink(application_x* app, InstallerContext* context) {
- boost::system::error_code boost_error;
+
bf::path bindir = context->GetPkgPath() /
bf::path("bin");
LOG(DEBUG) << "Creating dir: " << bindir;
return false;
}
- if (app->ui_gadget && strcmp(app->ui_gadget, "true") == 0) {
- // Ug-client path
- // Make a symlink with the name of appid, pointing /usr/bin/ug-client
- bf::path app_exec_path(app->exec);
- if (!bf::exists(app_exec_path)) {
- bf::path ug_client_path(tzplatform_mkpath(TZ_SYS_BIN, "ug-client"));
- LOG(INFO) << "Createing symlink " << app_exec_path << " pointing " <<
- ug_client_path;
- bf::create_symlink(ug_client_path, app_exec_path, boost_error);
- if (boost_error) {
- LOG(ERROR) << "Symlink creation failure: " << app_exec_path;
- return false;
- }
- }
+ if (!app->ui_gadget || strcmp(app->ui_gadget, "true") != 0)
+ return true;
+
+ bf::path app_exec_path(app->exec);
+ if (bf::exists(app_exec_path))
+ return true;
+
+ // Ug-client path
+ // Make a symlink with the name of appid, pointing /usr/bin/ug-client
+ bf::path ug_client_path(tzplatform_mkpath(TZ_SYS_BIN, "ug-client"));
+ LOG(INFO) << "Createing symlink " << app_exec_path << " pointing " <<
+ ug_client_path;
+ boost::system::error_code error;
+ bf::create_symlink(ug_client_path, app_exec_path, error);
+ if (error) {
+ LOG(ERROR) << "Symlink creation failure: " << app_exec_path
+ << ", error :" << error.what();
+ return false;
}
return true;