Commit e2fddfe5 authored by hybrid's avatar hybrid

Fix file search, bug found by Sylence

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@3484 dfc29bdd-3216-0410-991c-e03cc46cb475
parent e877b786
......@@ -128,18 +128,19 @@ u32 CFileList::getFileOffset(u32 index) const
s32 CFileList::findFile(const io::path& filename, bool isDirectory = false) const
{
SFileListEntry entry;
// we only need FullName to be set for the search
entry.FullName = filename;
entry.IsDirectory = isDirectory;
// swap
// exchange
entry.FullName.replace('\\', '/');
// remove trailing slash
if (entry.Name.lastChar() == '/')
if (entry.FullName.lastChar() == '/')
{
entry.IsDirectory = true;
entry.Name[ entry.Name.size()-1] = 0;
entry.Name.validate();
entry.FullName[entry.FullName.size()-1] = 0;
entry.FullName.validate();
}
if (IgnoreCase)
......@@ -151,12 +152,14 @@ s32 CFileList::findFile(const io::path& filename, bool isDirectory = false) cons
return Files.binary_search(entry);
}
//! Returns the base path of the file list
const io::path& CFileList::getPath() const
{
return Path;
}
} // end namespace irr
} // end namespace io
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment