#include <string>
#include "common/utils/file_util.h"
+#include "common/utils/glist_range.h"
namespace bf = boost::filesystem;
namespace ci = common_installer;
return true;
}
+bool HasResControl(manifest_x* manifest) {
+ GList* applications = manifest->application;
+ if (!applications)
+ return false;
+
+ for (application_x* app : GListRange<application_x*>(applications)) {
+ if (app->res_control)
+ return true;
+ }
+ return false;
+}
+
} // namespace
namespace common_installer {
LOG(ERROR) << "Failed to get pkg root directory";
return Status::APP_DIR_ERROR;
}
+
+ if (!context_->manifest_data.get()) {
+ LOG(ERROR) << "manifest_data attribute is empty";
+ return Status::MANIFEST_NOT_FOUND;
+ }
return Status::OK;
}
Step::Status StepCreateResControlDirectories::process() {
+ if (!HasResControl(context_->manifest_data.get()))
+ return Status::OK;
+
bf::path root = context_->GetPkgPath();
- // TODO(jeremy.jang): check the package has res-control tag (+ update case)
if (!CreateResControlDirs(root)) {
LOG(ERROR) << "Failed to create res-control directories";
return Status::APP_DIR_ERROR;
}
Step::Status StepCreateResControlDirectories::undo() {
+ if (!HasResControl(context_->manifest_data.get()))
+ return Status::OK;
+
bf::path root = context_->GetPkgPath();
if (!RemoveResControlDirs(root)) {
LOG(ERROR) << "Failed to remove res-control directories";