#include <libxml_utils.h>
#include <pkgmgr/pkgmgr_parser.h>
#include <dpl/localization/LanguageTagsProvider.h>
+#include <dpl/utils/path.h>
#define DEFAULT_ICON_NAME "icon.png"
#define DEFAULT_PREVIEW_NAME "preview.png"
if (std::find(generatedLocales.begin(), generatedLocales.end(),
*locale) != generatedLocales.end())
{
- if (icon->src == L"icon.jpg") {
- generatedLocales.push_back(*locale);
- } else if (icon->src == L"icon.gif") {
- generatedLocales.push_back(*locale);
- } else if (icon->src == L"icon.png") {
- generatedLocales.push_back(*locale);
- } else if (icon->src == L"icon.ico") {
- generatedLocales.push_back(*locale);
- } else if (icon->src == L"icon.svg") {
- generatedLocales.push_back(*locale);
- }
LogDebug("Skipping - has that locale");
continue;
} else {
generatedLocales.push_back(*locale);
}
- std::ostringstream sourceFile;
- std::ostringstream targetFile;
-
- sourceFile << m_context.locations->getSourceDir() << "/";
-
+ DPL::Utils::Path sourceFile(m_context.locations->getSourceDir());
if (!locale->empty()) {
- sourceFile << "locales/" << *locale << "/";
+ sourceFile /= "locales";
+ sourceFile /= *locale;
}
+ sourceFile /= src;
- sourceFile << src;
-
- targetFile << GlobalConfig::GetUserWidgetDesktopIconPath() << "/";
- targetFile << getIconTargetFilename(*locale);
+ DPL::Utils::Path targetFile(GlobalConfig::GetUserWidgetDesktopIconPath());
+ targetFile /= getIconTargetFilename(*locale, sourceFile.Extension());
if (m_context.widgetConfig.packagingType ==
WrtDB::PKG_TYPE_HOSTED_WEB_APP)
{
m_context.locations->setIconTargetFilenameForLocale(
- targetFile.str());
+ targetFile.Fullpath());
}
- LogDebug("Copying icon: " << sourceFile.str() <<
- " -> " << targetFile.str());
+ LogDebug("Copying icon: " << sourceFile << " -> " << targetFile);
- icon_list.push_back(targetFile.str());
+ icon_list.push_back(targetFile.Fullpath());
Try
{
- DPL::FileInput input(sourceFile.str());
- DPL::FileOutput output(targetFile.str());
+ DPL::FileInput input(sourceFile.Fullpath());
+ DPL::FileOutput output(targetFile.Fullpath());
DPL::Copy(&input, &output);
}
}
DPL::String TaskManifestFile::getIconTargetFilename(
- const DPL::String& languageTag) const
+ const DPL::String& languageTag, const std::string & ext) const
{
DPL::OStringStream filename;
TizenAppId appid = m_context.widgetConfig.tzAppid;
}
}
- filename << L".png";
+ if(!ext.empty())
+ {
+ filename << L"." + DPL::FromUTF8String(ext);
+ }
return filename.str();
}
tag = *locale;
}
- generateWidgetIcon(uiApp, tag, *locale, defaultIconSaved);
+ generateWidgetIcon(uiApp, tag, *locale, DPL::Utils::Path(icon->src).Extension(), defaultIconSaved);
}
}
if (!!defaultLocale && !defaultIconSaved) {
generateWidgetIcon(uiApp, DPL::OptionalString::Null,
DPL::String(),
+ std::string(),
defaultIconSaved);
}
}
void TaskManifestFile::generateWidgetIcon(UiApplication & uiApp,
const DPL::OptionalString& tag,
const DPL::String& language,
+ const std::string & extension,
bool & defaultIconSaved)
{
DPL::String locale;
}
DPL::String iconText;
- iconText += getIconTargetFilename(language);
+ iconText += getIconTargetFilename(language, extension);
if (!locale.empty()) {
uiApp.addIcon(IconType(iconText, locale));
}
std::ostringstream iconPath;
iconPath << GlobalConfig::GetUserWidgetDesktopIconPath() << "/";
- iconPath << getIconTargetFilename(locale);
- m_context.job->SendProgressIconPath(iconPath.str());
+ iconPath << getIconTargetFilename(locale, extension);
+ m_context.job->SendProgressIconPath(iconPath.str());
}
void TaskManifestFile::setWidgetDescription(Manifest & manifest)
DPL::OptionalString description);
void generateWidgetIcon(UiApplication & uiApp,
const DPL::OptionalString& tag,
- const DPL::String& language,
+ const DPL::String& language, const std::string &extension,
bool & defaultIconSaved);
void DynamicBoxFileCopy(const std::string& sourceFile,
const std::string& targetFile);
//for widget update
void backupIconFiles();
void getFileList(const char* path, std::list<std::string> &list);
- DPL::String getIconTargetFilename(const DPL::String& languageTag) const;
+ DPL::String getIconTargetFilename(const DPL::String& languageTag,
+ const std::string & ext) const;
static void saveLocalizedKey(std::ofstream &file,
const DPL::String& key,