#include <dpl/sstream.h>
#include <dpl/file_input.h>
#include <dpl/utils/wrt_utility.h>
+#include <dpl/utils/path.h>
#include <dpl/wrt-dao-ro/common_dao_types.h>
#include <dpl/wrt-dao-ro/widget_dao_read_only.h>
#include <dpl/wrt-dao-ro/global_config.h>
{
const char * const CONFIG_XML = "config.xml";
const char * const WITH_OSP_XML = "res/wgt/config.xml";
+const char * const OSP_MANIFEST_XML = "info/manifest.xml";
//allowed: a-z, A-Z, 0-9
const char* REG_TIZENID_PATTERN = "^[a-zA-Z0-9]{10}.{1,}$";
AddTask(new TaskEncryptResource(m_installerContext));
}
- if (m_installerContext.widgetConfig.packagingType !=
- WrtDB::PKG_TYPE_DIRECTORY_WEB_APP)
- {
+ if (m_installerContext.mode.extension !=
+ InstallMode::ExtensionType::DIR) {
AddTask(new TaskUpdateFiles(m_installerContext));
AddTask(new TaskFileManipulation(m_installerContext));
}
widgetPath, tempPath,
m_installerContext.widgetConfig.packagingType,
m_installerContext.mode.rootPath ==
- InstallMode::RootPath::RO);
+ InstallMode::RootPath::RO,
+ m_installerContext.mode.extension);
m_installerContext.locations->registerAppid(
DPL::ToUTF8String(m_installerContext.widgetConfig.tzAppid));
// Parse config
ParserRunner parser;
ConfigParserData configInfo;
-
Try
{
if (pkgType == PKG_TYPE_HOSTED_WEB_APP) {
new RootParser<WidgetParser>(configInfo,
DPL::FromUTF32String(
L"widget"))));
- } else if (pkgType == PKG_TYPE_DIRECTORY_WEB_APP) {
- std::string configPath;
- configPath = tempPath;
- configPath += "/";
- configPath += WITH_OSP_XML;
+ } else {
+ std::string configFile;
+ configFile = tempPath + "/" + CONFIG_XML;
+ if (!WrtUtilFileExists(configFile)) {
+ configFile = tempPath + "/" + WITH_OSP_XML;
+ }
if (isReinstall) {
// checking RDS data directory
- if (access(configPath.c_str(), F_OK) != 0) {
+ if (access(configFile.c_str(), F_OK) != 0) {
std::string tzAppId =
widgetSource.substr(widgetSource.find_last_of("/")+1);
WidgetDAOReadOnly dao(WidgetDAOReadOnly::getTzAppId(DPL::FromUTF8String(tzAppId)));
- configPath = DPL::ToUTF8String(*dao.getWidgetInstalledPath());
- configPath += "/";
- configPath += WITH_OSP_XML;
+ configFile = DPL::ToUTF8String(*dao.getWidgetInstalledPath());
+ configFile += "/";
+ configFile += WITH_OSP_XML;
}
}
- parser.Parse(configPath,
- ElementParserPtr(
- new RootParser<WidgetParser>(
- configInfo,
- DPL::FromUTF32String(L"widget"))));
- } else {
- std::string configFile;
- if (pkgType == PKG_TYPE_HYBRID_WEB_APP) {
- configFile = tempPath + "/" + WITH_OSP_XML;
- } else {
- configFile = tempPath + "/" + CONFIG_XML;
- }
parser.Parse(configFile,
ElementParserPtr(
LogError("Failed to find installed widget - give proper tizenId");
return ConfigParserData();
}
+ Catch(Exceptions::WidgetConfigFileNotFound){
+ LogError("Failed to find config.xml");
+ return ConfigParserData();
+ }
return configInfo;
}
const std::string &widgetSource,
const std::string &tempPath)
{
- // Check installation type (direcotory/ or config.xml or widget.wgt)
- if (m_installerContext.mode.extension == InstallMode::ExtensionType::DIR) {
- LogDebug("Install directly from directory");
- return PKG_TYPE_DIRECTORY_WEB_APP;
- }
if (hasExtension(widgetSource, XML_EXTENSION)) {
LogInfo("Hosted app installation");
return PKG_TYPE_HOSTED_WEB_APP;
}
- std::string configFile = tempPath + "/" + CONFIG_XML;
- if (WrtUtilFileExists(configFile)) {
- return PKG_TYPE_NOMAL_WEB_APP;
- }
-
- configFile = tempPath + "/" + WITH_OSP_XML;
+ std::string configFile = tempPath + "/" + OSP_MANIFEST_XML;
if (WrtUtilFileExists(configFile)) {
return PKG_TYPE_HYBRID_WEB_APP;
}
- return PKG_TYPE_UNKNOWN;
+ return PKG_TYPE_NOMAL_WEB_APP;
}
void JobWidgetInstall::setApplicationType(