step/step_encrypt_resources.cc
step/step_parse.cc
step/step_remove_encryption_data.cc
+ step/step_parse_recovery.cc
step/step_rds_parse.cc
step/step_rds_modify.cc
step/step_wgt_create_icons.cc
return true;
}
+bool StepParse::LocateConfigFile() {
+ return StepParse::Check(context_->unpacked_dir_path.get());
+}
+
common_installer::Step::Status StepParse::process() {
- if (!StepParse::Check(context_->unpacked_dir_path.get())) {
+ if (!LocateConfigFile()) {
LOG(ERROR) << "No config.xml";
return common_installer::Step::Status::ERROR;
}
Status undo() override { return Status::OK; }
Status precheck() override { return Status::OK; }
+ protected:
+ virtual bool LocateConfigFile();
+ bool Check(const boost::filesystem::path& widget_path);
+
+ boost::filesystem::path config_;
+
private:
std::set<std::string> ExtractPrivileges(
std::shared_ptr<const PermissionsInfo> perm_info) const;
bool FillManifestX(manifest_x* manifest);
std::unique_ptr<wgt::parse::WidgetConfigParser> parser_;
- boost::filesystem::path config_;
- bool Check(const boost::filesystem::path& widget_path);
SCOPE_LOG_TAG(Parse)
};
--- /dev/null
+// Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+// Use of this source code is governed by an apache-2.0 license that can be
+// found in the LICENSE file.
+
+#include "wgt/step/step_parse_recovery.h"
+
+#include "common/context_installer.h"
+
+namespace {
+
+const char kResWgtPath[] = "res/wgt";
+
+}
+
+namespace wgt {
+namespace parse {
+
+common_installer::Step::Status StepParseRecovery::process() {
+ (void) StepParse::process();
+ return Status::OK;
+}
+
+common_installer::Step::Status StepParseRecovery::precheck() {
+ if (context_->root_application_path.get().empty()) {
+ LOG(ERROR) << "Root path of packages in not set";
+ return Status::ERROR;
+ }
+ if (context_->pkgid.get().empty()) {
+ LOG(WARNING) << "Pkgid is not set. Parsing skipped";
+ return Status::OK;
+ }
+ return Status::OK;
+}
+
+bool StepParseRecovery::LocateConfigFile() {
+ context_->pkg_path.set(
+ context_->root_application_path.get() / context_->pkgid.get());
+
+ if (Check(common_installer::GetBackupPathForPackagePath(
+ context_->pkg_path.get()) / kResWgtPath))
+ return true;
+
+ if (Check(context_->pkg_path.get() / kResWgtPath))
+ return true;
+
+ return false;
+}
+
+} // namespace parse
+} // namespace wgt
--- /dev/null
+// Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+// Use of this source code is governed by an apache-2.0 license that can be
+// found in the LICENSE file.
+
+#ifndef WGT_STEP_STEP_PARSE_RECOVERY_H_
+#define WGT_STEP_STEP_PARSE_RECOVERY_H_
+
+#include "common/utils/logging.h"
+#include "wgt/step/step_parse.h"
+
+namespace wgt {
+namespace parse {
+/**
+ * @brief The StepParseRecovery class
+ * Retrievies package information from config.xml during RECOVERY.
+ *
+ * Step is used in recovery mode.
+ *
+ * Parse config.xml file by guessing possible locations:
+ * - backup package directory
+ * - package installation directory
+ * to get information about widget package to be recovered.
+ *
+ */
+class StepParseRecovery : public StepParse {
+ public:
+ using StepParse::StepParse;
+
+ Status process() override;
+ Status precheck() override;
+ bool LocateConfigFile() override;
+
+ SCOPE_LOG_TAG(ParseRecovery)
+};
+
+} // namespace parse
+} // namespace wgt
+
+#endif // WGT_STEP_STEP_PARSE_RECOVERY_H_