From e77fafcd98e5b60c2a614730e362aa686f1d868c Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Fri, 5 Mar 2010 15:10:34 +0000 Subject: [PATCH] From Sukender, "Here is a tiny fix for getNameLessExtension(). It does now check for the presence of slashes ('/' and '\') to avoid changing the string when having a dot in a directory. Old behaviour: "abc.d/filename_no_ext" -> "abc" New behaviour: "abc.d/filename_no_ext" -> "abc.d/filename_no_ext" Attached file is against rev. 11158." --- src/osgDB/FileNameUtils.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/osgDB/FileNameUtils.cpp b/src/osgDB/FileNameUtils.cpp index e66d40431..41e6e8779 100644 --- a/src/osgDB/FileNameUtils.cpp +++ b/src/osgDB/FileNameUtils.cpp @@ -138,8 +138,10 @@ std::string osgDB::convertToLowerCase(const std::string& str) // strip one level of extension from the filename. std::string osgDB::getNameLessExtension(const std::string& fileName) { - std::string::size_type dot = fileName.find_last_of('.'); - if (dot==std::string::npos) return fileName; + std::string::size_type dot = fileName.find_last_of('.'); + std::string::size_type back_slash = fileName.find_last_of('\\'); + std::string::size_type slash = fileName.find_last_of('/'); + if (dot==std::string::npos || (dot