Added getExtensionIncludingDot to provide more efficient handling of extensions

This commit is contained in:
Robert Osfield 2008-09-22 14:46:54 +00:00
parent 922b85b386
commit 48fe06fec3
2 changed files with 8 additions and 0 deletions

View File

@ -22,6 +22,7 @@ namespace osgDB {
extern OSGDB_EXPORT std::string getFilePath(const std::string& filename);
extern OSGDB_EXPORT std::string getFileExtension(const std::string& filename);
extern OSGDB_EXPORT std::string getFileExtensionIncludingDot(const std::string& filename);
extern OSGDB_EXPORT std::string getLowerCaseFileExtension(const std::string& filename);
extern OSGDB_EXPORT std::string getSimpleFileName(const std::string& fileName);
extern OSGDB_EXPORT std::string getNameLessExtension(const std::string& fileName);

View File

@ -66,6 +66,13 @@ std::string osgDB::getFileExtension(const std::string& fileName)
return std::string(fileName.begin()+dot+1,fileName.end());
}
std::string osgDB::getFileExtensionIncludingDot(const std::string& fileName)
{
std::string::size_type dot = fileName.find_last_of('.');
if (dot==std::string::npos) return std::string("");
return std::string(fileName.begin()+dot,fileName.end());
}
std::string osgDB::convertFileNameToWindowsStyle(const std::string& fileName)
{
std::string new_fileName(fileName);