bool CTextureBundleXBT::OpenBundle() { // Find the correct texture file (skin or theme) auto mediaDir = g_graphicsContext.GetMediaDir(); if (mediaDir.empty()) { mediaDir = CSpecialProtocol::TranslatePath( URIUtils::AddFileToFolder("special://home/addons", CServiceBroker::GetSettings().GetString(CSettings::SETTING_LOOKANDFEEL_SKIN))); } if (m_themeBundle) { // if we are the theme bundle, we only load if the user has chosen // a valid theme (or the skin has a default one) std::string theme = CServiceBroker::GetSettings().GetString(CSettings::SETTING_LOOKANDFEEL_SKINTHEME); if (!theme.empty() && !StringUtils::EqualsNoCase(theme, "SKINDEFAULT")) { std::string themeXBT(URIUtils::ReplaceExtension(theme, ".xbt")); m_path = URIUtils::AddFileToFolder(g_graphicsContext.GetMediaDir(), "media", themeXBT); } else { return false; } } else { m_path = URIUtils::AddFileToFolder(g_graphicsContext.GetMediaDir(), "media", "Textures.xbt"); } m_path = CSpecialProtocol::TranslatePathConvertCase(m_path); // Load the texture file if (!XFILE::CXbtManager::GetInstance().GetReader(CURL(m_path), m_XBTFReader)) { return false; } CLog::Log(LOGDEBUG, "%s - Opened bundle %s", __FUNCTION__, m_path.c_str()); m_TimeStamp = m_XBTFReader->GetLastModificationTimestamp(); if (lzo_init() != LZO_E_OK) { return false; } return true; }
bool CTextureBundleXBT::OpenBundle() { Cleanup(); // Find the correct texture file (skin or theme) CStdString strPath; if (m_themeBundle) { // if we are the theme bundle, we only load if the user has chosen // a valid theme (or the skin has a default one) CStdString theme = CSettings::Get().GetString("lookandfeel.skintheme"); if (!theme.IsEmpty() && theme.CompareNoCase("SKINDEFAULT")) { CStdString themeXBT(URIUtils::ReplaceExtension(theme, ".xbt")); strPath = URIUtils::AddFileToFolder(g_graphicsContext.GetMediaDir(), "media"); strPath = URIUtils::AddFileToFolder(strPath, themeXBT); } else { return false; } } else { strPath = URIUtils::AddFileToFolder(g_graphicsContext.GetMediaDir(), "media/Textures.xbt"); } strPath = CSpecialProtocol::TranslatePathConvertCase(strPath); // Load the texture file if (!m_XBTFReader.Open(strPath)) { return false; } CLog::Log(LOGDEBUG, "%s - Opened bundle %s", __FUNCTION__, strPath.c_str()); m_TimeStamp = m_XBTFReader.GetLastModificationTimestamp(); if (lzo_init() != LZO_E_OK) { return false; } return true; }
bool CTextureBundleXBT::OpenBundle() { Cleanup(); // Find the correct texture file (skin or theme) CStdString strPath; if (m_themeBundle) { // if we are the theme bundle, we only load if the user has chosen // a valid theme (or the skin has a default one) CStdString theme = g_guiSettings.GetString("lookandfeel.skintheme"); if (!theme.IsEmpty() && theme.CompareNoCase("SKINDEFAULT")) { CStdString themeXBT(CUtil::ReplaceExtension(theme, ".xbt")); strPath = CUtil::AddFileToFolder(g_graphicsContext.GetMediaDir(), "media"); strPath = CUtil::AddFileToFolder(strPath, themeXBT); } else { return false; } } else { strPath = CUtil::AddFileToFolder(g_graphicsContext.GetMediaDir(), "media/Textures.xbt"); } strPath = PTH_IC(strPath); // Load the texture file if (!m_XBTFReader.Open(strPath)) { return false; } m_TimeStamp = m_XBTFReader.GetLastModificationTimestamp(); if (lzo_init() != LZO_E_OK) { return false; } return true; }