Fix WgtArchiveInfo
[platform/core/appfw/wgt-backend.git] / src / lib / wgt_pkgmgr.cc
1 // Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
2 // Use of this source code is governed by a apache 2.0 license that can be
3 // found in the LICENSE file.
4
5 #include <package-manager-plugin.h>
6
7 #include "lib/wgt_archive_info.h"
8
9 #define EXPORT_API __attribute__((visibility("default")))
10
11 namespace {
12
13 int GetPackageArchiveInfo(const char* path,
14     package_manager_pkg_detail_info_t* info) {
15   WgtArchiveInfo archive_info(path);
16   if (!archive_info.LoadArchiveInfo())
17     return -1;
18   if (!archive_info.GetPkgDetailInfo(info))
19     return -1;
20   return 0;
21 }
22
23 void PluginOnUnload() {
24 }
25
26 }  // namespace
27
28 extern "C" EXPORT_API int pkg_plugin_on_load(pkg_plugin_set* set) {
29   if (set == nullptr)
30     return -1;
31   set->plugin_on_unload = PluginOnUnload;
32   set->pkg_is_installed = nullptr;
33   set->get_installed_pkg_list = nullptr;
34   set->get_pkg_detail_info = nullptr;
35   set->get_pkg_detail_info_from_package = GetPackageArchiveInfo;
36   return 0;
37 }