From: Bartlomiej Kunikowski Date: Mon, 13 Feb 2017 11:55:25 +0000 (+0100) Subject: Add some missing error checking X-Git-Tag: accepted/tizen/common/20170309.175302~6^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c188876720aba2d99bbc450d781d94183fe037d6;p=platform%2Fcore%2Fappfw%2Fwgt-backend.git Add some missing error checking Requires: - https://review.tizen.org/gerrit/#/c/114612/ Change-Id: I361068110fea571af6af6103a22dcf5b4d433d16 --- diff --git a/src/wgt/step/filesystem/step_create_symbolic_link.cc b/src/wgt/step/filesystem/step_create_symbolic_link.cc index d54ab59..e593350 100644 --- a/src/wgt/step/filesystem/step_create_symbolic_link.cc +++ b/src/wgt/step/filesystem/step_create_symbolic_link.cc @@ -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(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; } diff --git a/src/wgt/step/filesystem/step_wgt_patch_icons.cc b/src/wgt/step/filesystem/step_wgt_patch_icons.cc index 9eaa321..8f0a0a1 100644 --- a/src/wgt/step/filesystem/step_wgt_patch_icons.cc +++ b/src/wgt/step/filesystem/step_wgt_patch_icons.cc @@ -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(context_->manifest_data.get()->icon)) { bf::path icon_path = common_icon_location / diff --git a/src/wgt/step/pkgmgr/step_generate_xml.cc b/src/wgt/step/pkgmgr/step_generate_xml.cc index 7da9f76..370d403 100644 --- a/src/wgt/step/pkgmgr/step_generate_xml.cc +++ b/src/wgt/step/pkgmgr/step_generate_xml.cc @@ -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; } diff --git a/src/wgt/wgt_app_query_interface.cc b/src/wgt/wgt_app_query_interface.cc index a2bd61d..464165d 100644 --- a/src/wgt/wgt_app_query_interface.cc +++ b/src/wgt/wgt_app_query_interface.cc @@ -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( 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( 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; }