<<
"] cannot be allowed to use [" <<
DPL::ToUTF8String(it->name) + "] feature");
- }
- if (!WrtDB::FeatureDAOReadOnly::isFeatureInstalled(
- DPL::ToUTF8String(it->name)))
- {
- LogWarning("Feature not found. Checking if required :[" <<
- DPL::ToUTF8String(it->name) << "]");
-
- if (it->required) {
- /**
- * WL-3210 The WRT MUST inform the user if a widget cannot be
- * installed because one or more required features are not
- * supported.
- */
- std::ostringstream os;
- os <<
- "Widget cannot be installed, required feature is missing:["
- << DPL::ToUTF8String(it->name) << "]";
- if (!GlobalSettings::TestModeEnabled() && !isTizenWebApp()) {
- std::string label = os.str();
- createInstallPopup(PopupType::WIDGET_WRONG_FEATURE_INFO,
- label);
- }
- ThrowMsg(Exceptions::WidgetConfigFileInvalid, os.str());
- }
} else {
newList.insert(*it);
featureInfo += DPL::ToUTF8String(it->name);
widgetVersion) const
{
if (widgetVersion.IsNull() || (*widgetVersion).empty()) {
- LogWarning("minVersion attribute is empty. WRT assumes platform "
- "supports this widget.");
- return false;
+ if (appType == WrtDB::AppType::APP_TYPE_TIZENWEBAPP) {
+ return false;
+ } else {
+ LogWarning("minVersion attribute is empty. WRT assumes platform "
+ "supports this widget.");
+ return true;
+ }
}
//Parse widget version
WrtDB::ConfigParserData& configInfo,
const std::string& _currentPath)
{
- ParserRunner parser;
-
- //TODO: rewrite this madness
- std::string cfgAbsPath;
- DIR* dir = NULL;
-
- dir = opendir(_currentPath.c_str());
- if (dir == NULL) {
+ std::string configFilePath;
+ WrtUtilJoinPaths(configFilePath, _currentPath, WRT_WIDGET_CONFIG_FILE_NAME);
+ if (!WrtUtilFileExists(configFilePath))
+ {
+ LogError("Archive does not contain configuration file");
return false;
}
- bool has_config_xml = false;
- struct dirent ptr;
- struct dirent *result;
- int return_code;
- errno = 0;
-
- //Find configuration file, based on its name
- for (return_code = readdir_r(dir, &ptr, &result);
- result != NULL && return_code == 0;
- return_code = readdir_r(dir, &ptr, &result))
- {
- if (ptr.d_type == DT_REG) {
- if (!strcmp(ptr.d_name, WRT_WIDGET_CONFIG_FILE_NAME)) {
- std::string dName(ptr.d_name);
- WrtUtilJoinPaths(cfgAbsPath, _currentPath, dName);
-
- //Parse widget configuration file
- LogDebug("Found config: " << cfgAbsPath);
- Try
- {
- parser.Parse(cfgAbsPath, ElementParserPtr(new
- RootParser<
- WidgetParser>(
- configInfo,
- DPL
- ::
- FromUTF32String(
- L"widget"))));
- }
- Catch(ElementParser::Exception::Base)
- {
- LogError("Invalid widget configuration file!");
- if (-1 == TEMP_FAILURE_RETRY(closedir(dir))) {
- LogError(
- "Failed to close dir: " << _currentPath <<
- " with error: "
- << DPL::GetErrnoString());
- }
- return false;
- }
+ LogDebug("Configuration file: " << configFilePath);
- has_config_xml = true;
- break;
- }
- }
- }
- if (errno != 0) {
- LogError("readdir_r() failed with " << DPL::GetErrnoString());
- }
- errno = 0;
- if (-1 == TEMP_FAILURE_RETRY(closedir(dir))) {
- LogError("Failed to close dir: " << _currentPath << " with error: "
- << DPL::GetErrnoString());
+ Try
+ {
+ ParserRunner parser;
+ parser.Parse(configFilePath,
+ ElementParserPtr(new RootParser<WidgetParser>(
+ configInfo,
+ DPL::FromUTF32String(L"widget"))));
+ return true;
}
-
- //We must have config.xml so leaveing if we doesn't
- if (!has_config_xml) {
- LogError("Invalid archive");
+ Catch (ElementParser::Exception::Base)
+ {
+ LogError("Invalid configuration file!");
return false;
}
- return true;
}
bool TaskWidgetConfig::locateAndParseConfigurationFile(