Fix issue of icon copy when update and fix logic of select icon file 69/42869/2 accepted/tizen/mobile/20150708.065839 accepted/tizen/tv/20150708.065901 accepted/tizen/wearable/20150708.065915 submit/tizen/20150708.015609
authorInhwan Lee <ideal.lee@samsung.com>
Fri, 3 Jul 2015 09:30:53 +0000 (18:30 +0900)
committerInhwan Lee <ideal.lee@samsung.com>
Mon, 6 Jul 2015 03:34:58 +0000 (12:34 +0900)
- 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 [changed mode: 0644->0755]
src/common/step/step_generate_xml.cc
src/wgt/step/step_parse.cc

old mode 100644 (file)
new mode 100755 (executable)
index ddca989..d28a94f
@@ -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
index 70fc39c..6bc9748 100755 (executable)
@@ -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");
index bee7bf9..a9d5239 100755 (executable)
@@ -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());