diff --git a/include/osgDB/FileNameUtils b/include/osgDB/FileNameUtils index 9ffc515ed..72a36f510 100644 --- a/include/osgDB/FileNameUtils +++ b/include/osgDB/FileNameUtils @@ -27,6 +27,13 @@ extern OSGDB_EXPORT std::string getSimpleFileName(const std::string& fileName); extern OSGDB_EXPORT std::string getNameLessExtension(const std::string& fileName); extern OSGDB_EXPORT std::string getStrippedName(const std::string& fileName); + +extern OSGDB_EXPORT std::string convertFileNameToWindowsStyle(const std::string& fileName); +extern OSGDB_EXPORT std::string convertFileNameToUnixStyle(const std::string& fileName); + +extern OSGDB_EXPORT bool isFileNameNativeStyle(const std::string& fileName); +extern OSGDB_EXPORT std::string convertFileNameToNativeStyle(const std::string& fileName); + extern OSGDB_EXPORT bool equalCaseInsensitive(const std::string& lhs,const std::string& rhs); extern OSGDB_EXPORT bool equalCaseInsensitive(const std::string& lhs,const char* rhs); diff --git a/src/osgDB/FileNameUtils.cpp b/src/osgDB/FileNameUtils.cpp index 526bc8374..f5a7c891f 100644 --- a/src/osgDB/FileNameUtils.cpp +++ b/src/osgDB/FileNameUtils.cpp @@ -20,6 +20,8 @@ using std::strlen; #endif +#include + using namespace std; std::string osgDB::getFilePath(const std::string& fileName) @@ -57,6 +59,54 @@ std::string osgDB::getFileExtension(const std::string& fileName) return std::string(fileName.begin()+dot+1,fileName.end()); } +std::string osgDB::convertFileNameToWindowsStyle(const std::string& fileName) +{ + std::string new_fileName(fileName); + + std::string::size_type slash = 0; + while( (slash=new_fileName.find_first_of('/',slash)) != std::string::npos) + { + new_fileName[slash]='\\'; + } + return new_fileName; +} + +std::string osgDB::convertFileNameToUnixStyle(const std::string& fileName) +{ + osg::notify(osg::NOTICE)<<"convertFileNameToUnixStyle("<