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 <tzplatform_config.h>
7 #include <tpk_manifest_handlers/package_handler.h>
8 #include <tpk_manifest_handlers/tpk_config_parser.h>
15 #include "pkg_initdb/manifest_loader.h"
17 namespace fs = std::filesystem;
19 ManifestLoader::ManifestLoader(const std::string& path) {
20 path_ = fs::path(path);
23 std::list<ManifestInfo> ManifestLoader::LoadManifest() {
24 std::list<ManifestInfo> list;
25 std::cerr << "Loading manifest files from " << path_ << std::endl;
26 for (fs::directory_iterator iter(path_); iter != fs::directory_iterator();
28 if (!fs::is_regular_file(iter->path()))
31 tpk::parse::TPKConfigParser parser;
32 if (!parser.ParseManifest(iter->path())) {
33 std::cerr << "Failed to parse tizen manifest file: "
34 << parser.GetErrorMessage() << std::endl;
38 std::static_pointer_cast<const tpk::parse::PackageInfo>(
39 parser.GetManifestData(tpk::parse::PackageInfo::key()));
41 std::cerr << "Failed to get package info" << std::endl;
44 std::string type = package_info->type();
49 std::make_tuple(iter->path().string(), package_info->package(), type));