Skip to content

Commit

Permalink
fixed: settings.xml was queried repeatedly for addons where it didn't…
Browse files Browse the repository at this point in the history
… exist.

Easily seen running strace while the black screensaver is active
  • Loading branch information
theuni committed Feb 15, 2011
1 parent 99b071f commit c8405db
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
7 changes: 6 additions & 1 deletion xbmc/addons/Addon.cpp
Expand Up @@ -284,6 +284,7 @@ CAddon::CAddon(const cp_extension_t *ext)
BuildProfilePath();
CUtil::AddFileToFolder(Profile(), "settings.xml", m_userSettingsPath);
m_enabled = true;
m_hasSettings = true;
m_hasStrings = false;
m_checkedStrings = false;
m_settingsLoaded = false;
Expand All @@ -299,6 +300,7 @@ CAddon::CAddon(const AddonProps &props)
BuildProfilePath();
CUtil::AddFileToFolder(Profile(), "settings.xml", m_userSettingsPath);
m_enabled = true;
m_hasSettings = true;
m_hasStrings = false;
m_checkedStrings = false;
m_settingsLoaded = false;
Expand All @@ -313,6 +315,7 @@ CAddon::CAddon(const CAddon &rhs, const AddonPtr &parent)
m_addonXmlDoc = rhs.m_addonXmlDoc;
m_settingsLoaded = rhs.m_settingsLoaded;
m_userSettingsLoaded = rhs.m_userSettingsLoaded;
m_hasSettings = rhs.m_hasSettings;
BuildProfilePath();
CUtil::AddFileToFolder(Profile(), "settings.xml", m_userSettingsPath);
m_strLibName = rhs.m_strLibName;
Expand Down Expand Up @@ -447,13 +450,15 @@ bool CAddon::LoadSettings()
{
if (m_settingsLoaded)
return true;

if (!m_hasSettings)
return false;
CStdString addonFileName = CUtil::AddFileToFolder(m_props.path, "resources/settings.xml");

if (!m_addonXmlDoc.LoadFile(addonFileName))
{
if (CFile::Exists(addonFileName))
CLog::Log(LOGERROR, "Unable to load: %s, Line %d\n%s", addonFileName.c_str(), m_addonXmlDoc.ErrorRow(), m_addonXmlDoc.ErrorDesc());
m_hasSettings = false;
return false;
}

Expand Down
1 change: 1 addition & 0 deletions xbmc/addons/Addon.h
Expand Up @@ -223,6 +223,7 @@ class CAddon : public IAddon
virtual void ClearStrings();
bool m_hasStrings;
bool m_checkedStrings;
bool m_hasSettings;

CStdString m_profile;
bool m_enabled;
Expand Down

0 comments on commit c8405db

Please sign in to comment.