Removed now redundent local implementation of getDirectoryContexts()
This commit is contained in:
parent
76b6cd6fa3
commit
e0f4fa453c
@ -524,70 +524,6 @@ bool OSGA_Archive::getFileNames(FileNameList& fileNameList) const
|
|||||||
return !fileNameList.empty();
|
return !fileNameList.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
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)
|
|
||||||
{
|
|
||||||
const std::string& filename = itr->first;
|
|
||||||
if (filename.size()>dirName.size())
|
|
||||||
{
|
|
||||||
// check for match of directory name while accounting for potential
|
|
||||||
// differences in types of slashes
|
|
||||||
unsigned int i=0;
|
|
||||||
for(; i<dirName.size(); ++i)
|
|
||||||
{
|
|
||||||
char f = filename[i];
|
|
||||||
char d = dirName[i];
|
|
||||||
if (f=='\\') f='/';
|
|
||||||
if (d=='\\') d='/';
|
|
||||||
if (f!=d) break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (i==dirName.size())
|
|
||||||
{
|
|
||||||
bool directoryMatched = false;
|
|
||||||
if (!dirNameHasTrailingSlash)
|
|
||||||
{
|
|
||||||
// no trailing slash on dirName so we won't have matched
|
|
||||||
// the required slash on filename to make sure the next character is slash.
|
|
||||||
char f = filename[i];
|
|
||||||
|
|
||||||
// check for slash
|
|
||||||
if (f=='\\' || f=='/')
|
|
||||||
{
|
|
||||||
// found slash, now need to skip over it.
|
|
||||||
++i;
|
|
||||||
directoryMatched = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
directoryMatched = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (directoryMatched)
|
|
||||||
{
|
|
||||||
files.push_back(filename.substr(i));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return files;
|
|
||||||
}
|
|
||||||
|
|
||||||
void OSGA_Archive::writeIndexBlocks()
|
void OSGA_Archive::writeIndexBlocks()
|
||||||
{
|
{
|
||||||
SERIALIZER();
|
SERIALIZER();
|
||||||
|
@ -59,11 +59,6 @@ class OSGA_Archive : public osgDB::Archive
|
|||||||
/** Get the full list of file names available in the archive.*/
|
/** Get the full list of file names available in the archive.*/
|
||||||
virtual bool getFileNames(FileNameList& fileNameList) const;
|
virtual bool getFileNames(FileNameList& fileNameList) const;
|
||||||
|
|
||||||
/** return the contents of a directory.
|
|
||||||
* returns an empty array on any error.*/
|
|
||||||
virtual osgDB::DirectoryContents getDirectoryContents(const std::string& dirName) const;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** Read an osg::Object of specified file name from the Archive.*/
|
/** Read an osg::Object of specified file name from the Archive.*/
|
||||||
virtual ReadResult readObject(const std::string& fileName,const Options* options=NULL) const;
|
virtual ReadResult readObject(const std::string& fileName,const Options* options=NULL) const;
|
||||||
|
Loading…
Reference in New Issue
Block a user