From 3c6dd26f80614ac185a4291bbb3c68e88766e5d6 Mon Sep 17 00:00:00 2001 From: Inhwan Lee Date: Fri, 3 Jul 2015 18:30:53 +0900 Subject: [PATCH] Fix issue of icon copy when update and fix logic of select icon file - fix issue that if icon file is absent, try to copy not exist file when update - when manifest parser give multiple icon to installer, select first icon to use Change-Id: I0de521cb454a9d58f3c8a873394a5243e212d44e --- src/common/step/step_backup_icons.cc | 3 ++- src/common/step/step_generate_xml.cc | 8 ++++---- src/wgt/step/step_parse.cc | 7 +++++-- 3 files changed, 11 insertions(+), 7 deletions(-) mode change 100644 => 100755 src/common/step/step_backup_icons.cc diff --git a/src/common/step/step_backup_icons.cc b/src/common/step/step_backup_icons.cc old mode 100644 new mode 100755 index ddca989..d28a94f --- a/src/common/step/step_backup_icons.cc +++ b/src/common/step/step_backup_icons.cc @@ -25,7 +25,8 @@ Step::Status StepBackupIcons::process() { app_icon += ".png"; bf::path icon_backup = app_icon; icon_backup += ".bck"; - icons_.emplace_back(app_icon, icon_backup); + if (bf::exists(app_icon)) + icons_.emplace_back(app_icon, icon_backup); } // backup diff --git a/src/common/step/step_generate_xml.cc b/src/common/step/step_generate_xml.cc index 70fc39c..6bc9748 100755 --- a/src/common/step/step_generate_xml.cc +++ b/src/common/step/step_generate_xml.cc @@ -88,17 +88,17 @@ Step::Status StepGenerateXml::GenerateApplicationCommonXml(T* app, fs::path app_icon = fs::path(context_->pkg_path.get()) / fs::path(app->appid) / fs::path(app->icon->name); - if (fs::exists(app_icon)) + if (fs::exists(app_icon)) { fs::copy_file(app_icon, icon_path_ /= icon, fs::copy_option::overwrite_if_exists); + xmlTextWriterWriteFormatElement(writer, BAD_CAST "icon", + "%s", BAD_CAST icon.c_str()); + } } else { //Default icon setting is role of the platform LOG(DEBUG) << "Icon was not found in package"; } - xmlTextWriterWriteFormatElement(writer, BAD_CAST "icon", - "%s", BAD_CAST icon.c_str()); - for (appcontrol_x* appc = app->appcontrol; appc != nullptr; appc = appc->next) { xmlTextWriterStartElement(writer, BAD_CAST "app-control"); diff --git a/src/wgt/step/step_parse.cc b/src/wgt/step/step_parse.cc index bee7bf9..a9d5239 100755 --- a/src/wgt/step/step_parse.cc +++ b/src/wgt/step/step_parse.cc @@ -145,8 +145,11 @@ bool StepParse::FillApplicationInfo(manifest_x* manifest) { manifest->uiapplication->appid = strdup(app_info->id().c_str()); manifest->uiapplication->type = strdup("webapp"); - if (manifest->icon) - manifest->uiapplication->icon->name = strdup(manifest->icon->name); + if (manifest->icon) { + icon_x* icon = nullptr; + LISTHEAD(manifest->icon, icon); + manifest->uiapplication->icon->name = strdup(icon->name); + } manifest->uiapplication->next = nullptr; manifest->package = strdup(app_info->package().c_str()); -- 2.7.4