1 // Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
2 // Use of this source code is governed by an apache-2.0 license that can be
3 // found in the LICENSE file.
5 #include "common/step/filesystem/step_remove_icons.h"
7 #include <pkgmgr-info.h>
12 #include <system_error>
14 #include "common/utils/file_util.h"
15 #include "common/utils/glist_range.h"
17 namespace fs = std::filesystem;
19 namespace common_installer {
20 namespace filesystem {
22 Step::Status StepRemoveIcons::precheck() {
23 if (!context_->manifest_data.get()) {
24 LOG(ERROR) << "manifest_data attribute is empty";
25 return Status::MANIFEST_NOT_FOUND;
31 Step::Status StepRemoveIcons::process() {
32 const char* extra_icon_path = getIconPath(context_->uid.get(),
33 context_->is_readonly_package.get());
36 for (auto iter = fs::directory_iterator(extra_icon_path);
37 iter != fs::directory_iterator(); ++iter) {
38 if (!fs::is_regular_file(iter->path()))
40 std::error_code error;
41 for (application_x* app :
42 GListRange<application_x*>(
43 context_->manifest_data.get()->application)) {
45 std::string filename = iter->path().filename().string();
46 if (filename.find(app->appid) == 0) {
55 } // namespace filesystem
56 } // namespace common_installer