Fix icon creation for tpk-backend 19/45719/2 accepted/tizen/mobile/20150812.005346 accepted/tizen/tv/20150812.005408 accepted/tizen/wearable/20150812.005444 submit/tizen/20150811.123928
authorTomasz Iwanek <t.iwanek@samsung.com>
Mon, 10 Aug 2015 14:15:25 +0000 (16:15 +0200)
committerPawel Sikorski <p.sikorski@samsung.com>
Tue, 11 Aug 2015 07:58:25 +0000 (00:58 -0700)
Tpk-backend still tried to create icon in StepCreateSymbolicLink

Change-Id: I90bad97635f7869844ab301543fd05498f5052bb

src/common/step/step_create_icons.cc
src/tpk/step/step_create_symbolic_link.cc

index eb8589b..a683606 100644 (file)
@@ -35,18 +35,20 @@ Step::Status StepCreateIcons::process() {
     // icons should be localized
     if (ui->icon && ui->icon->name) {
       bf::path source = GetIconRoot() / ui->icon->name;
-      bf::path destination = icons_directory / ui->appid;
-      if (destination.has_extension())
-        destination += source.extension();
-      else
-        destination += ".png";
-      bs::error_code error;
-      bf::copy_file(source, destination, error);
-      if (error) {
-        LOG(ERROR) << "Cannot create package icon: " << destination;
-        return Status::ERROR;
+      if (bf::exists(source)) {
+        bf::path destination = icons_directory / ui->appid;
+        if (destination.has_extension())
+          destination += source.extension();
+        else
+          destination += ".png";
+        bs::error_code error;
+        bf::copy_file(source, destination, error);
+        if (error) {
+          LOG(ERROR) << "Cannot create package icon: " << destination;
+          return Status::ERROR;
+        }
+        icons_.push_back(destination);
       }
-      icons_.push_back(destination);
     }
   }
   LOG(DEBUG) << "Icon files created";
index 79ba465..72b7855 100644 (file)
@@ -58,35 +58,6 @@ bool CreateSymLink(T *app, ContextInstaller* context) {
       LOG(ERROR) << "Permission change failure";
       return false;
     }
-
-    // Icon path
-    // Make an Icon symlink, if the icon exists
-    if (app->icon && app->icon->name) {
-      // Check if the icon file actually exists
-      fs::path src_icon_path = fs::path(context->pkg_path.get())
-          / fs::path(app->icon->name);
-      if (fs::exists(src_icon_path)) {
-        // copy icon to the destination dir
-        fs::path dest_icon_dir = fs::path(getIconPath(context->uid.get()));
-        fs::path dest_icon_filename = fs::path(app->appid) +=
-            fs::path(app->icon->name).extension();
-        if (!common_installer::CreateDir(dest_icon_dir)) {
-          LOG(ERROR) << "Directory creation failure: " << dest_icon_dir;
-          return false;
-        }
-        fs::path dest_icon_path = dest_icon_dir;
-        dest_icon_path /= dest_icon_filename;
-        LOG(INFO) << "Creating symlink " << dest_icon_path << " pointing " <<
-            src_icon_path;
-        fs::create_symlink(src_icon_path, dest_icon_path, boost_error);
-        if (boost_error) {
-          LOG(ERROR) << "Symlink creation failure: " << dest_icon_path;
-          return false;
-        }
-      } else {
-        LOG(WARNING) << "No icon file found in the package: " << src_icon_path;
-      }
-    }
   }
   return true;
 }