corrected the FileExtension helper func as suggested in BUG#55

This commit is contained in:
Paolo Cignoni 2016-02-24 05:57:27 +00:00
parent 4867a33379
commit 662d0ce811
1 changed files with 3 additions and 5 deletions

View File

@ -94,15 +94,13 @@ return lastType;
public:
// simple aux function that returns true if a given file has a given extesnion
static bool FileExtension(std::string filename, std::string extension)
static bool FileExtension(std::string filename, std::string extension)
{
std::locale loc1 ;
std::use_facet<std::ctype<char> > ( loc1 ).tolower(&*filename.begin(),&*filename.rbegin());
std::use_facet<std::ctype<char> > ( loc1 ).tolower(&*extension.begin(),&*extension.rbegin());
std::transform(filename.begin(), filename.end(), filename.begin(), ::tolower);
std::transform(extension.begin(), extension.end(), extension.begin(), ::tolower);
std::string end=filename.substr(filename.length()-extension.length(),extension.length());
return end==extension;
}
// Open Mesh, returns 0 on success.
static int Open(OpenMeshType &m, const char *filename, CallBackPos *cb=0)
{