Skip to content

Commit

Permalink
return meshes extension as lower case for x sign check
Browse files Browse the repository at this point in the history
  • Loading branch information
mebbaid committed Jan 5, 2024
1 parent ff85d7e commit cf578ff
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions src/visualization/src/IrrlichtUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@

#include <cmath>



namespace iDynTree
{

Expand Down Expand Up @@ -131,19 +133,22 @@ inline iDynTree::Rotation RotationWithPrescribedZColumn(const iDynTree::Directio
return R;
}

inline std::string getFileExt(const std::string filename)
inline std::string getFileExt(const std::string& filename)
{
std::string::size_type idx;
auto idx = filename.rfind('.');

idx = filename.rfind('.');

if (idx != std::string::npos)
if (idx != std::string::npos && idx + 1 < filename.size())
{
return filename.substr(idx+1);
std::string ext = filename.substr(idx + 1);
std::transform(ext.begin(), ext.end(), ext.begin(), [](unsigned char c) {
return std::tolower(c);
});

return ext;
}
else
{
return "";
return ""; // No extension found
}
}

Expand Down

0 comments on commit cf578ff

Please sign in to comment.