supplemental 2 to 04a8e71a22

Origin commit data
------------------
Branch: ni/coolstream
Commit: 26e1bbc426
Author: TangoCash <eric@loxat.de>
Date: 2021-10-29 (Fri, 29 Oct 2021)


------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
TangoCash
2021-10-29 19:33:33 +02:00
committed by vanhofen
parent 6bc4a63f28
commit 8d484e0611

View File

@@ -698,15 +698,19 @@ void CFrameBuffer::setIconBasePath(const std::string & iconPath)
std::string CFrameBuffer::getIconPath(std::string icon_name, std::string file_type)
{
// why search when we have an absolut path ?
if (icon_name.find("/", 0) != std::string::npos)
return icon_name;
std::vector<std::string> filetypes = { ".svg", ".png", ".jpg" };
std::string path, filetype = "";
std::string path = icon_name;
std::string::size_type pos = icon_name.find_last_of(".");
if (pos != std::string::npos && file_type.empty())
if (std::find(filetypes.begin(), filetypes.end(), icon_name.substr(pos)) != filetypes.end())
{
icon_name = icon_name.substr(0,pos);
file_type = icon_name.substr(pos+1);
icon_name = path.substr(0,pos);
file_type = path.substr(pos+1);
}
if (!file_type.empty())
{
@@ -734,10 +738,8 @@ std::string CFrameBuffer::getIconPath(std::string icon_name, std::string file_ty
}
}
if (icon_name.find("/", 0) != std::string::npos)
path = icon_name;
return path;
// nothing found, return empty string
return "";
}
void CFrameBuffer::getIconSize(const char * const filename, int* width, int *height)