1 // Copyright (c) 2020 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 <boost/filesystem/path.hpp>
6 #include <boost/filesystem/operations.hpp>
8 #include <tzplatform_config.h>
10 #include <tpk_manifest_handlers/package_handler.h>
11 #include <tpk_manifest_handlers/tpk_config_parser.h>
17 #include "pkg_initdb/manifest_loader.h"
19 namespace bf = boost::filesystem;
21 ManifestLoader::ManifestLoader(const std::string& path) {
22 path_ = bf::path(path);
25 std::list<ManifestInfo> ManifestLoader::LoadManifest() {
26 std::list<ManifestInfo> list;
27 std::cerr << "Loading manifest files from " << path_ << std::endl;
28 for (bf::directory_iterator iter(path_); iter != bf::directory_iterator();
30 if (!bf::is_regular_file(iter->path()))
33 tpk::parse::TPKConfigParser parser;
34 if (!parser.ParseManifest(iter->path())) {
35 std::cerr << "Failed to parse tizen manifest file: "
36 << parser.GetErrorMessage() << std::endl;
40 std::static_pointer_cast<const tpk::parse::PackageInfo>(
41 parser.GetManifestData(tpk::parse::PackageInfo::key()));
43 std::cerr << "Failed to get package info" << std::endl;
46 std::string type = package_info->type();
51 std::make_tuple(iter->path().string(), package_info->package(), type));