if (menuIcon.IsEmpty() == false)
{
String menuIconPath;
- menuIconPath.Format(1024, L"%ls%ls/%ls", __pContext->__rootPath.GetPointer(), DIR_SHARED_RES, menuIcon.GetPointer());
+ GetIconPath(menuIcon, menuIconPath);
__pWriter->StartElement("icon");
__pWriter->WriteString(menuIconPath);
if (pAppData->__mainmenuIcon.IsEmpty() == false)
{
String iconPath;
- iconPath.Format(1024, L"%ls%ls/%ls", __pContext->__rootPath.GetPointer(), DIR_SHARED_RES, pAppData->__mainmenuIcon.GetPointer());
+ GetIconPath(pAppData->__mainmenuIcon, iconPath);
__pWriter->StartElement("icon");
__pWriter->WriteString(iconPath);
if (pAppData->__mainmenuIcon.IsEmpty() == false)
{
String iconPath;
- iconPath.Format(1024, L"%ls%ls/%ls", __pContext->__rootPath.GetPointer(), DIR_SHARED_RES, pAppData->__mainmenuIcon.GetPointer());
+ GetIconPath(pAppData->__mainmenuIcon, iconPath);
__pWriter->StartElement("icon");
__pWriter->WriteString(iconPath);
if (pAppData->__settingIcon.IsEmpty() == false)
{
String iconPath;
- iconPath.Format(1024, L"%ls%ls/%ls", __pContext->__rootPath.GetPointer(), DIR_SHARED_RES, pAppData->__settingIcon.GetPointer());
+ GetIconPath(pAppData->__settingIcon, iconPath);
__pWriter->StartElement("icon");
__pWriter->WriteAttribute("section", "setting");
if (pAppData->__notificationIcon.IsEmpty() == false)
{
String iconPath;
- iconPath.Format(1024, L"%ls%ls/%ls", __pContext->__rootPath.GetPointer(), DIR_SHARED_RES, pAppData->__notificationIcon.GetPointer());
+ GetIconPath(pAppData->__notificationIcon, iconPath);
__pWriter->StartElement("icon");
__pWriter->WriteAttribute("section", "notification");
if (pAppData->__mainmenuIcon.IsEmpty() == false)
{
String iconPath;
- iconPath.Format(1024, L"%ls%ls/%ls", __pContext->__rootPath.GetPointer(), DIR_SHARED_RES, pAppData->__mainmenuIcon.GetPointer());
+ GetIconPath(pAppData->__mainmenuIcon, iconPath);
__pWriter->StartElement("icon");
__pWriter->WriteString(iconPath);
return true;
}
+
+bool
+ManifestGenerator::GetIconPath(const String& icon, String& iconPath) const
+{
+ String tempIconPath;
+ tempIconPath.Format(1024, L"%ls%ls/%ls", __pContext->__rootPath.GetPointer(), DIR_SHARED_RES, icon.GetPointer());
+
+ if (File::IsFileExist(tempIconPath) == false)
+ {
+ AppLog("fallback, old path = [%ls]", tempIconPath.GetPointer());
+
+ String densityXhigh("screen-density-xhigh/");
+ String densityHigh("screen-density-high/");
+
+ if (icon.Contains(densityXhigh) == true)
+ {
+ tempIconPath.Replace(densityXhigh, densityHigh);
+ }
+ else if (icon.Contains(densityHigh) == true)
+ {
+ tempIconPath.Replace(densityHigh, densityXhigh);
+ }
+ else
+ {
+ AppLog("invalid icon [%ls]", icon.GetPointer());
+ return false;
+ }
+
+ AppLog("fallback, new path = [%ls]", tempIconPath.GetPointer());
+
+ if (File::IsFileExist(tempIconPath) == false)
+ {
+ AppLog("fallback, but file is not found. [%ls]", tempIconPath.GetPointer());
+ return false;
+ }
+ }
+
+ iconPath = tempIconPath;
+
+ AppLog("icon[%ls], iconPath[%ls]", icon.GetPointer(), iconPath.GetPointer());
+
+ return true;
+}