#include "DDSImage.h"
#include "Picture.h"
#include "TextureManager.h"
-#include "SpecialProtocol.h"
+#include "URIUtils.h"
using namespace XFILE;
bool CTextureCache::IsCachedImage(const CStdString &url) const
{
- if (0 == strncmp(url.c_str(), "special://skin/", 15)) // a skin image
- return true;
if (url != "-" && !CURL::IsFullPath(url))
return true;
- CStdString basePath(g_settings.GetThumbnailsFolder());
- if (0 == strncmp(url.c_str(), basePath.c_str(), basePath.GetLength()))
+ if (CURIUtils::IsInPath(url, "special://skin/") ||
+ CURIUtils::IsInPath(url, g_settings.GetThumbnailsFolder()))
return true;
- if (basePath.Left(8).Equals("special:"))
- {
- basePath = CSpecialProtocol::TranslatePath(basePath);
- if (0 == strncmp(url.c_str(), basePath.c_str(), basePath.GetLength()))
- return true;
- }
return false;
}
CStdString path(GetCachedImage(url));
if (!path.IsEmpty())
{
- if (returnDDS && 0 != strncmp(url.c_str(), "special://skin/", 15)) // TODO: should skin images be .dds'd (currently they're not necessarily writeable)
+ if (returnDDS && !CURIUtils::IsInPath(url, "special://skin/")) // TODO: should skin images be .dds'd (currently they're not necessarily writeable)
{ // check for dds version
CStdString ddsPath = CUtil::ReplaceExtension(path, ".dds");
if (CFile::Exists(ddsPath))
#include "system.h"\r
#include "Util.h"\r
#include "URIUtils.h"\r
+#include "SpecialProtocol.h"
\r
CStdString CURIUtils::GetParentFolderURI(const CStdString& uri, bool preserveFileNameInPath)\r
{\r
else\r
return CUtil::GetParentPath(uri);\r
}\r
+\r
+bool CURIUtils::IsInPath(const CStdString &uri, const CStdString &baseURI)\r
+{\r
+ CStdString uriPath = CSpecialProtocol::TranslatePath(uri);\r
+ CStdString basePath = CSpecialProtocol::TranslatePath(baseURI);\r
+ return (strncmp(uriPath.c_str(), basePath.c_str(), basePath.GetLength()) == 0);\r
+}\r
CURIUtils(void);\r
virtual ~CURIUtils(void);\r
static CStdString GetParentFolderURI(const CStdString& uri, bool preserveFileNameInPath);\r
+ static bool IsInPath(const CStdString &uri, const CStdString &baseURI);\r
};\r