diff --git a/include/osgDB/FileNameUtils b/include/osgDB/FileNameUtils index 944101a1a..234bec22f 100644 --- a/include/osgDB/FileNameUtils +++ b/include/osgDB/FileNameUtils @@ -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); diff --git a/src/osgDB/FileNameUtils.cpp b/src/osgDB/FileNameUtils.cpp index b8cc4c1c2..605fc94dc 100644 --- a/src/osgDB/FileNameUtils.cpp +++ b/src/osgDB/FileNameUtils.cpp @@ -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);