Skip to content

Commit

Permalink
[utils] change old "URIUtils::HasExtension(...)" to give his vector t…
Browse files Browse the repository at this point in the history
…o new function

As on commit before the new function was added where handle the strings by vector, is on old the code no more needed and can call the new.
  • Loading branch information
AlwinEsch committed Sep 7, 2023
1 parent fcb8643 commit 0862cb4
Showing 1 changed file with 2 additions and 22 deletions.
24 changes: 2 additions & 22 deletions xbmc/utils/URIUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,28 +90,8 @@ bool URIUtils::HasExtension(const CURL& url, const std::string& strExtensions)

bool URIUtils::HasExtension(const std::string& strFileName, const std::string& strExtensions)
{
if (IsURL(strFileName))
{
const CURL url(strFileName);
return HasExtension(url.GetFileName(), strExtensions);
}

const size_t pos = strFileName.find_last_of("./\\");
if (pos == std::string::npos || strFileName[pos] != '.')
return false;

const std::string extensionLower = StringUtils::ToLower(strFileName.substr(pos));

const std::vector<std::string> extensionsLower =
StringUtils::Split(StringUtils::ToLower(strExtensions), '|');

for (const auto& ext : extensionsLower)
{
if (StringUtils::EndsWith(ext, extensionLower))
return true;
}

return false;
const std::vector<std::string> extList = StringUtils::Split(strExtensions, '|');
return HasExtension(strFileName, extList);
}

bool URIUtils::HasExtension(const CURL& url, const std::vector<std::string>& extList)
Expand Down

0 comments on commit 0862cb4

Please sign in to comment.