Add some missing error checking 16/114616/2
authorBartlomiej Kunikowski <b.kunikowski@partner.samsung.com>
Mon, 13 Feb 2017 11:55:25 +0000 (12:55 +0100)
committerBartlomiej Kunikowski <b.kunikowski@partner.samsung.com>
Thu, 2 Mar 2017 11:56:57 +0000 (03:56 -0800)
Requires:
 - https://review.tizen.org/gerrit/#/c/114612/

Change-Id: I361068110fea571af6af6103a22dcf5b4d433d16

src/wgt/step/filesystem/step_create_symbolic_link.cc
src/wgt/step/filesystem/step_wgt_patch_icons.cc
src/wgt/step/pkgmgr/step_generate_xml.cc
src/wgt/wgt_app_query_interface.cc

index d54ab59..e593350 100644 (file)
@@ -43,8 +43,7 @@ bool StepCreateSymbolicLink::CreateSymlinksForApps() {
     common_installer::CreateDir(exec_path);
 
     exec_path /= bf::path(app->appid);
-    if (bf::exists(exec_path))
-      bf::remove_all(exec_path);
+    common_installer::RemoveAll(exec_path);
 
     if (strcmp(app->component_type, "uiapp") == 0) {
       bf::create_symlink(bf::path(kWRTPath), exec_path, error);
@@ -78,8 +77,7 @@ common_installer::Step::Status StepCreateSymbolicLink::undo() {
   for (application_x* app :
        GListRange<application_x*>(context_->manifest_data.get()->application)) {
     bf::path exec_path = context_->pkg_path.get() / "bin" / app->appid;
-    if (bf::exists(exec_path))
-      bf::remove_all(exec_path);
+    common_installer::RemoveAll(exec_path);
   }
   return Status::OK;
 }
index 9eaa321..8f0a0a1 100644 (file)
@@ -53,6 +53,10 @@ common_installer::Step::Status StepWgtPatchIcons::process() {
   bf::path common_icon_location = context_->pkg_path.get() / "shared" / "res";
   bs::error_code error;
   bf::create_directories(common_icon_location, error);
+  if (error) {
+    LOG(ERROR) << "Failed to create common icon location directory";
+    return Status::ICON_ERROR;
+  }
   for (icon_x* icon :
       GListRange<icon_x*>(context_->manifest_data.get()->icon)) {
     bf::path icon_path = common_icon_location /
index 7da9f76..370d403 100644 (file)
@@ -305,9 +305,7 @@ common_installer::Step::Status StepGenerateXml::GenerateApplicationCommonXml(
 }
 
 common_installer::Step::Status StepGenerateXml::undo() {
-  bs::error_code error;
-  if (bf::exists(context_->xml_path.get()))
-    bf::remove_all(context_->xml_path.get(), error);
+  common_installer::RemoveAll(context_->xml_path.get());
   return Status::OK;
 }
 
index a2bd61d..464165d 100644 (file)
@@ -47,7 +47,7 @@ std::string GetPkgIdFromPath(const std::string& path) {
     return {};
   if (!common_installer::ExtractToTmpDir(path.c_str(), tmp_path,
       "config.xml")) {
-    bf::remove_all(tmp_path, code);
+    ci::RemoveAll(tmp_path);
     return {};
   }
   bf::path config_path = tmp_path / "config.xml";
@@ -60,19 +60,19 @@ std::string GetPkgIdFromPath(const std::string& path) {
   std::unique_ptr<parser::ManifestParser> parser(
       new parser::ManifestParser(std::move(registry)));
   if (!parser->ParseManifest(config_path)) {
-    bf::remove_all(tmp_path, code);
+    ci::RemoveAll(tmp_path);
     return {};
   }
   auto info = std::static_pointer_cast<const wgt::parse::TizenApplicationInfo>(
       parser->GetManifestData(
           wgt::application_widget_keys::kTizenApplicationKey));
   if (!info) {
-    bf::remove_all(tmp_path, code);
+    ci::RemoveAll(tmp_path);
     return {};
   }
   std::string pkg_id = info->package();
 
-  bf::remove_all(tmp_path, code);
+  ci::RemoveAll(tmp_path);
   return pkg_id;
 }