std::transform(aFileName.begin(), aFileName.end(), aFileName.begin(), toupper);
// Is file name ends with the format
for (; itFormats != aFormats.end(); ++itFormats) {
- if (aFileNameLen > (*itFormats).length()) {
- size_t aFormatBeginPos = aFileNameLen - (*itFormats).length();
- if (aFileName.compare(aFormatBeginPos, std::string::npos, *itFormats) == 0) {
+ std::string aFormat = "." + *itFormats;
+ if (aFileNameLen > aFormat.length()) {
+ size_t aFormatBeginPos = aFileNameLen - aFormat.length();
+ if (aFileName.compare(aFormatBeginPos, std::string::npos, aFormat) == 0) {
return true;
}
}
TCollection_AsciiString aFileName(theFileName.c_str());
OSD_Path aPath(aFileName);
TCollection_AsciiString anExtension = aPath.Extension();
+ if (anExtension.Length() < 2)
+ return "";
// TCollection_AsciiString are numbered from 1
anExtension = anExtension.SubString(2, anExtension.Length());
anExtension.UpperCase();