Skip to content
Browse files

changed: load addons from user directory first, then load from system…

… dir and skip any whith id's already loaded

git-svn-id: https://xbmc.svn.sourceforge.net/svnroot/xbmc/trunk@29430 568bbfeb-2a22-0410-94d2-cc84cf5bfa90
  • Loading branch information...
1 parent 617d4f7 commit 535b4e71ae357f0cb36f98081c01c7aa3b84c490 elupus committed Apr 22, 2010
Showing with 15 additions and 1 deletion.
  1. +14 −1 xbmc/addons/AddonManager.cpp
  2. +1 −0 xbmc/addons/AddonManager.h
View
15 xbmc/addons/AddonManager.cpp
@@ -244,9 +244,15 @@ void CAddonMgr::FindAddons()
CSingleLock lock(m_critSection);
m_addons.clear();
m_idMap.clear();
+ LoadAddons("special://home/addons");
+ LoadAddons("special://xbmc/addons");
+}
+
+void CAddonMgr::LoadAddons(const CStdString &path)
+{
// parse the user & system dirs for addons of the requested type
CFileItemList items;
- CDirectory::GetDirectory("special://xbmc/addons", items);
+ CDirectory::GetDirectory(path, items);
// store any addons with unresolved deps, then recheck at the end
VECADDONS unresolved;
@@ -264,6 +270,13 @@ void CAddonMgr::FindAddons()
if (!AddonFromInfoXML(item->m_strPath, addon))
continue;
+ // only load if addon with same id isn't already loaded
+ if(m_idMap.find(addon->ID()) != m_idMap.end())
+ {
+ CLog::Log(LOGDEBUG, "ADDON: already loaded id %s, bypassing package", addon->ID().c_str());
+ continue;
+ }
+
// refuse to store addons with missing library
CStdString library(CUtil::AddFileToFolder(addon->Path(), addon->LibName()));
if (!CFile::Exists(library))
View
1 xbmc/addons/AddonManager.h
@@ -88,6 +88,7 @@ namespace ADDON
static AddonPtr AddonFromProps(AddonProps& props);
void UpdateRepos();
void FindAddons();
+ void LoadAddons(const CStdString &path);
void OnJobComplete(unsigned int jobID, bool sucess, CJob* job);
private:

0 comments on commit 535b4e7

Please sign in to comment.
Something went wrong with that request. Please try again.