diff --git a/src/osgPlugins/osga/OSGA_Archive.cpp b/src/osgPlugins/osga/OSGA_Archive.cpp index 49881c48a..79886ef2e 100644 --- a/src/osgPlugins/osga/OSGA_Archive.cpp +++ b/src/osgPlugins/osga/OSGA_Archive.cpp @@ -527,6 +527,16 @@ bool OSGA_Archive::getFileNames(FileNameList& fileNameList) const osgDB::DirectoryContents OSGA_Archive::getDirectoryContents(const std::string& dirName) const { osgDB::DirectoryContents files; + if (dirName.empty() || dirName==".") + { + getFileNames(files); + return files; + } + + bool dirNameHasTrailingSlash = false; + char d = dirName[dirName.size()-1]; + if (d=='\\' || d=='/') dirNameHasTrailingSlash = true; + for(FileNamePositionMap::const_iterator itr=_indexMap.begin(); itr!=_indexMap.end(); ++itr) @@ -548,21 +558,30 @@ osgDB::DirectoryContents OSGA_Archive::getDirectoryContents(const std::string& d if (i==dirName.size()) { - // directory name matched, but need to make sure a trailing filename exists - // and to skip over any immediate slashes - char f = filename[i]; - - // check for slash - if (f=='\\' || f=='/') + bool directoryMatched = false; + if (!dirNameHasTrailingSlash) { - // found slash, now need to skip over it. - ++i; - if (i