2 * Copyright (C) 2005-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
11 #include "addons/addoninfo/AddonInfo.h"
12 #include "utils/StringUtils.h"
13 #include "utils/URIUtils.h"
17 static const std::set
<AddonType
> dependencyTypes
= {
18 AddonType::SCRAPER_LIBRARY
,
19 AddonType::SCRIPT_LIBRARY
,
20 AddonType::SCRIPT_MODULE
,
22 } /* namespace ADDON */
24 using namespace ADDON
;
26 std::string
CAddonType::LibPath() const
28 if (m_libname
.empty())
30 return URIUtils::AddFileToFolder(m_path
, m_libname
);
33 void CAddonType::SetProvides(const std::string
& content
)
38 * Normally the "provides" becomes added from xml scan, but for add-ons
39 * stored in the database (e.g. repository contents) it might not be
40 * available. Since this information is available in add-on metadata for the
41 * main type (see extrainfo) we take the function contents and insert it if
44 if (GetValue("provides").empty())
45 Insert("provides", content
);
47 for (const auto& provide
: StringUtils::Split(content
, ' '))
49 AddonType content
= CAddonInfo::TranslateSubContent(provide
);
50 if (content
!= AddonType::UNKNOWN
)
51 m_providedSubContent
.insert(content
);
56 bool CAddonType::IsDependencyType(AddonType type
)
58 return dependencyTypes
.find(type
) != dependencyTypes
.end();