From: Junghyun Yeon Date: Mon, 28 Nov 2016 02:41:38 +0000 (+0900) Subject: Stop using pkgdir-tool for directory operation X-Git-Tag: accepted/tizen/3.0/common/20161203.012111~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a5e5ec4eed2328c983d0c4603e556777994f4eb4;p=platform%2Fcore%2Fappfw%2Ftpk-backend.git Stop using pkgdir-tool for directory operation - Backend has cap itself so another tool dedicated to directory operation is no more needed - Adjust order of including header for coding style Change-Id: Ie86d253303e1a013400ba6dcc5b5e38bae2f2c3d Signed-off-by: Junghyun Yeon --- diff --git a/src/tpk/external_dirs.cc b/src/tpk/external_dirs.cc index ac79c33..0a07126 100644 --- a/src/tpk/external_dirs.cc +++ b/src/tpk/external_dirs.cc @@ -4,7 +4,6 @@ #include "tpk/external_dirs.h" -#include #include #include #include @@ -33,16 +32,17 @@ bool CreateExternalAppdataDirectories(const std::string& pkgid, switch (request_mode) { case ci::RequestMode::GLOBAL: { LOG(DEBUG) << "Creating external directories for all users"; - ci::RequestCreateExternalDirectories(pkgid); - break; + return ci::PerformExternalDirectoryCreationForAllUsers(pkgid); } case ci::RequestMode::USER: { LOG(DEBUG) << "Creating external directories for user: " << uid; - ci::PerformExternalDirectoryCreationForUser(uid, pkgid); - break; + return ci::PerformExternalDirectoryCreationForUser(uid, pkgid); + } + default: { + LOG(ERROR) << "UNexpected request mode"; + return false; } } - return true; } bool DeleteExternalAppdataDirectories(const std::string& pkgid, @@ -50,8 +50,7 @@ bool DeleteExternalAppdataDirectories(const std::string& pkgid, switch (request_mode) { case ci::RequestMode::GLOBAL: { LOG(DEBUG) << "Removing external directories for all users"; - ci::RequestDeleteExternalDirectories(pkgid); - break; + return ci::PerformExternalDirectoryDeletionForAllUsers(pkgid); } case ci::RequestMode::USER: { // if package is globally installed, leave directories @@ -59,11 +58,13 @@ bool DeleteExternalAppdataDirectories(const std::string& pkgid, return true; LOG(DEBUG) << "Removing external directories for user: " << uid; - ci::PerformExternalDirectoryDeletionForUser(uid, pkgid); - break; + return ci::PerformExternalDirectoryDeletionForUser(uid, pkgid); + } + default: { + LOG(ERROR) << "Unexpected request mode"; + return false; } } - return true; } } // namespace tpk diff --git a/src/tpk/step/filesystem/step_create_external_storage_directories.cc b/src/tpk/step/filesystem/step_create_external_storage_directories.cc index bbe3d5c..2cdf090 100644 --- a/src/tpk/step/filesystem/step_create_external_storage_directories.cc +++ b/src/tpk/step/filesystem/step_create_external_storage_directories.cc @@ -22,11 +22,13 @@ ci::Step::Status StepCreateExternalStorageDirectories::process() { if (!HasExternalAppdataPrivilege(context_->manifest_data.get())) { LOG(DEBUG) << "External storage privilege not found, skipping."; return Status::OK; - } else { - if (!CreateExternalAppdataDirectories(context_->pkgid.get(), - context_->request_mode.get(), - context_->uid.get())) - return Status::APP_DIR_ERROR; + } + + if (!CreateExternalAppdataDirectories(context_->pkgid.get(), + context_->request_mode.get(), + context_->uid.get())) { + LOG(ERROR) << "Failed to create external appdata directories"; + return Status::APP_DIR_ERROR; } return Status::OK; }