#include <boost/filesystem/path.hpp>
#include <wgt_manifest_handlers/widget_config_parser.h>
+#include <wgt_manifest_handlers/addon_handler.h>
#include <wgt_manifest_handlers/application_icons_handler.h>
#include <wgt_manifest_handlers/application_manifest_constants.h>
#include <wgt_manifest_handlers/permissions_handler.h>
auto widget_info =
std::static_pointer_cast<const wgt::parse::WidgetInfo>(
parser.GetManifestData(wgt::parse::WidgetInfo::Key()));
+ if (!widget_info) {
+ LOG(ERROR) << "WidgetInfo not found";
+ return false;
+ }
+
+ type_ = "wgt";
+ version_ = widget_info->version().c_str();
+ author_ = widget_info->author().c_str();
+
+ return true;
+}
+
+bool WgtArchiveInfo::GetApplicationInfo(
+ const wgt::parse::WidgetConfigParser& parser) {
auto app_info =
std::static_pointer_cast<const wgt::parse::TizenApplicationInfo>(
parser.GetManifestData(wgt::parse::TizenApplicationInfo::Key()));
- if (!widget_info || !app_info) {
- LOG(ERROR) << "WidgetInfo / TizenApplicationInfo not found";
+ if (!app_info)
return false;
- }
- type_ = "wgt";
name_ = app_info->package().c_str();
pkgid_ = app_info->package().c_str();
- version_ = widget_info->version().c_str();
api_version_ = app_info->required_version().c_str();
- author_ = widget_info->author().c_str();
+
+ return true;
+}
+
+bool WgtArchiveInfo::GetAddonInfo(
+ const wgt::parse::WidgetConfigParser& parser) {
+ auto addon_info =
+ std::static_pointer_cast<const wgt::parse::AddonInfo>(
+ parser.GetManifestData(wgt::parse::AddonInfo::Key()));
+ if (!addon_info)
+ return false;
+
+ name_ = addon_info->package().c_str();
+ pkgid_ = addon_info->package().c_str();
+ api_version_ = addon_info->required_version().c_str();
return true;
}
bf::remove_all(tmp_dir);
return false;
}
+ if (!GetApplicationInfo(parser)) {
+ if (!GetAddonInfo(parser)) {
+ LOG(ERROR) << "Failed to get application info nor addon info. "
+ << "At least one of them must exist";
+ bf::remove_all(tmp_dir);
+ return false;
+ }
+ }
+
if (!GetPrivilegesInfo(parser))
LOG(WARNING) << "Failed to get privileges info";
if (!GetIconInfo(parser))
private:
bool GetPackageInfo(const wgt::parse::WidgetConfigParser& parser);
+ bool GetApplicationInfo(const wgt::parse::WidgetConfigParser& parser);
+ bool GetAddonInfo(const wgt::parse::WidgetConfigParser& parser);
bool GetPrivilegesInfo(const wgt::parse::WidgetConfigParser& parser);
bool GetIconInfo(const wgt::parse::WidgetConfigParser& parser);
bool ReadIcon(const bf::path& icon, const bf::path& tmp_dir);